我有XML文档这样的:XSLT子元素
<OrdersSchedulePDFView>
<OrdersSchedulePDFViewRow>
<Items>
<ItemDesc>Content1</ItemDesc>
<ItemDesc>Content2</ItemDesc>
</Items>
<Locations>
<LocName>Content3</LocName>
<LocName>Content4</LocName>
</Locations>
</OrdersSchedulePDFViewRow>
</OrdersSchedulePDFView>
请给我一个例子XSL文件,在那里我可以通过模板得到ItemDesc和LOCNAME元素。在此先感谢 这是我的xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="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:template match="Locations">
<xsl:copy>
<xsl:apply-templates select="LocName"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Items">
<xsl:copy>
<xsl:apply-templates select="ItemDesc"/>
</xsl:copy>
</xsl:template>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>
</xsl:stylesheet>
你究竟在做什么?你可以尝试''(如果元素上没有我们可能看不到的名称空间),但模板应该做什么? –
我需要打印ItemDesc和LocName元素。但我无法通过让他们的 的 –
你为什么不发表您的尝试,所以我们可以解决这个问题,而不是有从头开始为您编写代码。此外,请显示您期望得到的**精确**输出。 –