A
Andrew
Hi,
Im puzzled with the following XSL transformation. I want to be able to
find out the next element name in XML.
XML:
<?xml version="1.0"?>
<records>
<record>
<page>
<id>1</id>
<data1>100</data1>
<data2>Mr. Joe Bloggs</data2>
</page>
</record>
</records>
XSL:
<xsl:template name="TransactionLine">
<xslaram name="TransactionTotal">2</xslaram>
<xsl:if test="number($TransactionTotal) > 0">
<xsl:call-template name="Transaction">
<xsl:with-param name="TransactionID" select="$TransactionTotal"/>
</xsl:call-template>
<xsl:call-template name="TransactionLine">
<xsl:with-param name="TransactionTotal"
select="number($TransactionTotal) - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="Transaction">
<xslaram name="TransactionID"/>
<xsl:for-each select="//record/page/*">
<xsl:if test="following::.[name() =
concat('data',$TransactionID)">
<xsl:value-of select="text()"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
I would appreciate your comments.
Andrew
Im puzzled with the following XSL transformation. I want to be able to
find out the next element name in XML.
XML:
<?xml version="1.0"?>
<records>
<record>
<page>
<id>1</id>
<data1>100</data1>
<data2>Mr. Joe Bloggs</data2>
</page>
</record>
</records>
XSL:
<xsl:template name="TransactionLine">
<xslaram name="TransactionTotal">2</xslaram>
<xsl:if test="number($TransactionTotal) > 0">
<xsl:call-template name="Transaction">
<xsl:with-param name="TransactionID" select="$TransactionTotal"/>
</xsl:call-template>
<xsl:call-template name="TransactionLine">
<xsl:with-param name="TransactionTotal"
select="number($TransactionTotal) - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="Transaction">
<xslaram name="TransactionID"/>
<xsl:for-each select="//record/page/*">
<xsl:if test="following::.[name() =
concat('data',$TransactionID)">
<xsl:value-of select="text()"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
I would appreciate your comments.
Andrew