這是我的xml:XSLT-FO的for-each
<OrdersSchedulePDFView>
<OrdersSchedulePDFViewRow>
<Locations>
<LocName>Text1</LocName>
<LocName>Text2</LocName>
</Locations>
</OrdersSchedulePDFViewRow>
</OrdersSchedulePDFView>
這是從我的XSLT-FO文件片段:
<xsl:template match="OrdersSchedulePDFView">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:for-each select="./OrdersSchedulePDFViewRow">
<fo:page-sequence master-reference="all">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="Locations">
<xsl:apply-templates select="."/>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>
<xsl:template match="Locations">
<fo:block text-align="left" font-family="Arial">
<fo:inline font-weight="bold"><xsl:value-of select="LocName"/></fo:inline>
</fo:block>
</xsl:template>
</xsl:stylesheet>
但在PDF我只有一個LOCNAME。我如何獲得所有LocName元素?
''僅獲取第一個'LocName'(在XSLT 1.0中)的值。爲了獲得它們,你需要使用''。或者將模板應用於它們,並添加相應的模板。 ---順便說一句,你不**需要使用''爲了應用匹配'Locations'的模板。只要說''。 –
最後,我明白了這一點。 的 的的 的 \t <的xsl:for-每個選擇= 「./ LOCNAME 」> 的 的的 \t的xsl:for-each>的\t XSL:模板> –