What is XSLT? (译)

What is XSLT?

Extensible Stylesheet Language Transformations (XSLT) has evolved from the early Extensible Stylesheet Language (XSL) standard. XSL specifies a language definition for XML data presentation and data transformations. Data presentation means displaying data in some format and/or medium. Presentation is about style. Data transformation means parsing an input XML document into a tree of nodes, and then converting the source tree into a result tree. Transformation is about data exchange.

Because these functionalities serve two distinct purposes, XSLT was proposed and later accepted as a separate standard for XML data transformation only. XSL is now generally referred to as XSL Formatting Objects (XSL-FO), to distinguish it from XSLT. The future of XSL-FO as a standard is uncertain, because much of its functionality overlaps with that provided by cascading style sheets (CSS) and the HTML tag set. If cross-vendor compatibility is important, you might want to avoid XSL-FO until it becomes a standard fully accepted by the Worldwide Web Consortium.

--------------------------------------------------

翻译:

什么是XSLT?

扩展样式表语言转换(XSLT)由早期的扩展样式表语言(XSL)标准进化而来。XSL为XML数据表现和转换指定一种语义。数据表现意味着要将数据显示成某些格式及(或)某些媒体上,是关于样式上的表现。数据转换则意味着将输入的XML文档解析为一棵树,并将源树转换为目标树,是关于数据上的变换。

因为这些功能服务着两个截然不同的目的,于是XSLT被提出并在之后被接受成为一种区别的标准,仅仅作为XML数据转换之用。而现在,一般只在作为XSL格式化对象(XSL-FO)时才被提到,以区别于XSLT。XSL-FO在未来能否会成为标准,那是无法确定,因为它的许多功能与层叠式样式表(CSS)及HTML标签集重叠。如果跨供应商兼容性很重要,你应该在XSL-FO完全成为W3C标准前避免使用它。

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
XSLT中,确实没有内置的split函数来分割字符串。但是你可以使用递归和substring函数来实现类似的功能。下面是一个示例代码,展示了如何在XSLT中实现一个简单的split函数: ``` <xsl:template name="split"> <xsl:param name="input" /> <xsl:param name="delimiter" select="','" /> <xsl:choose> <xsl:when test="contains($input, $delimiter)"> <xsl:value-of select="substring-before($input, $delimiter)" /> <xsl:text> </xsl:text> <xsl:call-template name="split"> <xsl:with-param name="input" select="substring-after($input, $delimiter)" /> <xsl:with-param name="delimiter" select="$delimiter" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$input" /> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> ``` 这个模板将接受两个参数:input和delimiter。它会逐个输出input中使用delimiter分隔的部分,并在每个部分后面添加一个换行符。 你可以在需要的地方调用这个模板,传递对应的参数来实现你的需求。比如,你可以在你的XSLT文档的某个模板中这样使用它: ``` <xsl:call-template name="split"> <xsl:with-param name="input" select="'ItemA,ItemB,ItemC'" /> <xsl:with-param name="delimiter" select="','" /> </xsl:call-template> ``` 这样,将会以换行符分隔的形式输出"ItemA"、"ItemB"和"ItemC"。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [在xslt中实现split方法对查询字符串进行分隔](https://blog.csdn.net/ddjq1044/article/details/101340306)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [利用xsltxml中数据实现splite换行的总结](https://blog.csdn.net/gaotong2055/article/details/84128994)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值