我对“步入”一无所知xsl:variable
。如果有人能解释“步骤”,我将不胜感激。
以下 XSLT 仅在根元素中包含 2 个元素。
xsl:output
定义输出格式;
xsl:variable
定义变量;
如何解析这段代码?这段代码代表什么?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"
version="2.0"
extension-element-prefixes="saxon">
<xsl:output method="html" omit-xml-declaration="yes"
encoding="utf-8" indent="no"/>
<!-- <xsl:output method="xml" omit-xml-declaration="no"
encoding="utf-8" indent="no"/> -->
<xsl:variable name="processes">
<!-- exclude elements with @specific-use='print-only' -->
<step>prep/jpub3-webfilter.xsl</step>
<!-- format citations in NLM/PMC format -->
<step>citations-prep/jpub3-PMCcit.xsl</step>
<!-- convert into HTML for display -->
<step>main/jpub3-html.xsl</step>
</xsl:variable>
<xsl:include href="main/shell-utility.xsl"/>
</xsl:stylesheet>
补充“shell-utility.xsl”
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"
version="2.0"
extension-element-prefixes="saxon">
<!-- This stylesheet does not stand alone! It is a component
to be called into XSLT 2.0 shell stylesheets. -->
<xsl:variable name="document" select="/" saxon:assignable="yes"/>
<xsl:param name="runtime-params">
<base-dir>
<xsl:value-of
select="replace(base-uri(/), '/[^/]+$','')"/>
</base-dir>
</xsl:param>
<xsl:template match="/">
<xsl:for-each select="$processes/step/concat('../',.)">
<xsl:message>
<xsl:text>
... Applying </xsl:text>
<xsl:value-of select="."/>
</xsl:message>
<saxon:assign name="document"
select="saxon:transform(
saxon:compile-stylesheet(doc(.)),
$document,
$runtime-params/* )"/>
<!-- A third argument to saxon:transform could specify
runtime parameters for any (or all) steps -->
</xsl:for-each>
<xsl:sequence select="$document"/>
<xsl:message>
... Done</xsl:message>
</xsl:template>
</xsl:stylesheet>