My XML and XSL is below. Also below is a textual representation of what I
want to get out of the XML with XSL. For each Extension node in XML, I am
only concerned with those nodes with fieldTypeCodes of 10 - 17. For any
given query there will be up to 4 Extension nodes fitting this criteria. I
have everything working except for being able to insert a, b, c or d in the
<box12 tags. Notice each row or found node has a different letter. There
will be only 4 occurances so basically I am looking for a way to add a, b, c
or d as appropriate. As you might tell by my XSL, I am a complete newbie.
Please help with pointers or answers.
Thanks, John
What I want outputted:
<box12a-1>L</box12a-1> <box12a-2>6635.86</box12a-2>
<box12b-1>J</box12b-1> <box12b-2>663.00</box12b-2>
<box12c-1>N</box12c-1> <box12c-2>5.86</box12c-2>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xalan="ht tp://xml.apache.org/xslt">
<xsl:output method="html" />
<xsl:variable name="TaxRecord Node" select="ptrsTax Record/TaxRecord" />
<xsl:variable name="Extension Node"
select="$TaxRec ordNode/taxDetail/extensions/Extension" />
<xsl:variable name="FieldType Node"
select="$TaxRec ordNode/taxReturnType/fieldTypes/FieldType" />
<xsl:template match="TaxRecor d">
<html>
<body>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 10</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 11</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 12</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 13</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 14</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 15</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="fred">
<xsl:with-param name="minNode"> 16</xsl:with-param>
</xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="barney">
<xsl:param name="minNode" />
<xsl:variable name="num" select="$Extens ionNode">
<xsl:number count="*" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$Extensio nNode/fieldTypeCode=$ minNode">
<xsl:number value="$num" format="a" />
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="fred">
<xsl:param name="minNode" />
<xsl:variable name="num" select="$Extens ionNode">
<xsl:number count="*" />
</xsl:variable>
<!-- ALL FIELDTYPES -->
<xsl:if test="$Extensio nNode/fieldTypeCode=$ minNode and
$ExtensionNode/fieldTypeCode=$ minNode">
<box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-1>
<xsl:value-of select="$FieldT ypeNode[fieldTypeCode=$ minNode]/description"
/>
</box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-1> <box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e"><xsl:numb er
value="$num" format="a" /></xsl:with-param>
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-2>
<xsl:value-of
select="$Extens ionNode[fieldTypeCode=$ minNode]/reportableAmoun t" />
</box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-2>
<br />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<ptrsTaxRecor d>
<TaxRecord>
<taxDetail>
<extensions>
<Extension>
<reportableTe xt />
<fieldTypeCode> 11</fieldTypeCode>
<reportableAmou nt>6635.86</reportableAmoun t>
</Extension>
<Extension>
<reportableTe xt />
<fieldTypeCode> 14</fieldTypeCode>
<reportableAmou nt>663.00</reportableAmoun t>
</Extension>
<Extension>
<reportableTe xt />
<fieldTypeCode> 16</fieldTypeCode>
<reportableAmou nt>5.86</reportableAmoun t>
</Extension>
<Extension>
<reportableTe xt />
<fieldTypeCode> 40</fieldTypeCode>
<reportableAmou nt>1.00</reportableAmoun t>
</Extension>
</extensions>
</taxDetail>
<taxReturnTyp e>
<fieldTypes>
<FieldType>
<description> D</description>
<fieldTypeCode> 10</fieldTypeCode>
</FieldType>
<FieldType>
<description> L</description>
<fieldTypeCode> 11</fieldTypeCode>
</FieldType>
<FieldType>
<description> E</description>
<fieldTypeCode> 12</fieldTypeCode>
</FieldType>
<FieldType>
<description> G</description>
<fieldTypeCode> 13</fieldTypeCode>
</FieldType>
<FieldType>
<description> J</description>
<fieldTypeCode> 14</fieldTypeCode>
</FieldType>
<FieldType>
<description> M</description>
<fieldTypeCode> 15</fieldTypeCode>
</FieldType>
<FieldType>
<description> N</description>
<fieldTypeCode> 16</fieldTypeCode>
</FieldType>
<FieldType>
<description> P</description>
<fieldTypeCode> 17</fieldTypeCode>
</FieldType>
</fieldTypes>
</taxReturnType>
</TaxRecord>
</ptrsTaxRecord>