【发布时间】:2014-12-24 15:02:47
【问题描述】:
我有一个如下所示的 XML 文件
- <alert>
- <adv_details>
<type>Primary Type</type>
<name>Some Name</name>
<id>ID Num</id>
<adv_details>
.....
<alert>
我的 XSL 看起来像这样
<fo:flow flow-name="xsl-region-body">
<xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
<fo:block>
<xsl:for-each select="//alert">
<xsl:call-template name="alert_details">
<xsl:with-param name="xmlSection" select="./alert_details"/>
</xsl:call-template>
......
然后我尝试到达节点<adv_details> 内元素的每个值。
首先我声明这个模板名称<xsl:template name="alert_details">,整个代码是
<xsl:template name="alert_details">
<fo:table>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block >
<xsl:value-of select="./@type"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block >
<xsl:value-of select="./@name"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block >
<xsl:value-of select="./id"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
它不显示值!
我认为这是一个正确的方法。首先,我有 for-each select="//alert,然后我有 <xsl:with-param name="xmlSection" select="./alert_details"/>,最后,我选择了 alert_details 中的每个节点,但不知何故,这些值没有显示出来。
请帮忙。
【问题讨论】: