By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,606 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,606 IT Pros & Developers. It's quick & easy.

xsl:number as abc problem Please help?

P: n/a
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:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="html" />
<xsl:variable name="TaxRecordNode" select="ptrsTaxRecord/TaxRecord" />
<xsl:variable name="ExtensionNode"
select="$TaxRecordNode/taxDetail/extensions/Extension" />
<xsl:variable name="FieldTypeNode"
select="$TaxRecordNode/taxReturnType/fieldTypes/FieldType" />

<xsl:template match="TaxRecord">
<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="$ExtensionNode">
<xsl:number count="*" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$ExtensionNode/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="$ExtensionNode">
<xsl:number count="*" />
</xsl:variable>

<!-- ALL FIELDTYPES -->

<xsl:if test="$ExtensionNode/fieldTypeCode=$minNode and
$ExtensionNode/fieldTypeCode=$minNode">
&lt;box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNode" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-1&gt;
<xsl:value-of select="$FieldTypeNode[fieldTypeCode=$minNode]/description"
/>
&lt;/box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNode" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-1&gt; &lt;box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNode"><xsl:number
value="$num" format="a" /></xsl:with-param>
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-2&gt;
<xsl:value-of
select="$ExtensionNode[fieldTypeCode=$minNode]/reportableAmount" />
&lt;/box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNode" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-2&gt;
<br />
</xsl:if>
</xsl:template>
</xsl:stylesheet>

<?xml version="1.0" encoding="UTF-8"?>
<ptrsTaxRecord>
<TaxRecord>
<taxDetail>
<extensions>
<Extension>
<reportableText />
<fieldTypeCode>11</fieldTypeCode>
<reportableAmount>6635.86</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>14</fieldTypeCode>
<reportableAmount>663.00</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>16</fieldTypeCode>
<reportableAmount>5.86</reportableAmount>
</Extension>
<Extension>
<reportableText />
<fieldTypeCode>40</fieldTypeCode>
<reportableAmount>1.00</reportableAmount>
</Extension>
</extensions>
</taxDetail>
<taxReturnType>
<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>

Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.