473,378 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

xsl:number as abc problem Please help?

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
0 1860

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: poisontheused | last post by:
I'm attempting to display the following XML code in an HTML table usin an XSL stylesheet. but am having a few problems. First off an extract from the XML which was generated using Crysta Reports...
3
by: Andy Fish | last post by:
In my XSLT stylesheet, if I call <xsl:number level="any" count="sdfsjdfjsdfksndfn"/> where there are no preceeding nodes called "sdfsjdfjsdfksndfn" I would expect it to return 0. However, on...
3
by: b0yce | last post by:
Hi Group, I think I have found a problem with the <xsl:element> when being transformed by the .NET xmlTransform class. When using XmlSpy for development and debugging, the <xsl:number>...
8
by: Larry Coon | last post by:
I'm trying to use xsl for the first time, and as with any first-time attempt, I'm running into problems. I'm trying to transform an XML document into another XML document with a slightly...
5
by: Guiding5 | last post by:
Hi group! Basic question about counting specific nodes in the range, here the example: XSL: <xsl:stylesheet version="1.0"> <xsl:template match="/">
0
by: Jean-François Michaud | last post by:
Hello all, I'm looking into putting together an alternate page numbering on a figure element that we have to deal with. Each figure has its own page sequence through the use of an...
0
by: rahulash | last post by:
I have a JSP showing data retreived from a database. This JSP is styled based on an XSL. The database returns data like student name, course, student remarks. I intend to add a checkbox which...
2
by: shapper | last post by:
Hello, I created a XSL file to convert a XML file to another XML. I am running this in Asp.Net but this is not working. ----- ORIGINAL XML ----- <?xml version="1.0" encoding="utf-8" ?>...
14
by: ajfish | last post by:
Hi, I am trying to allocate a unique ID to every instance of tag 'foo' in a large XML document. currently I'm doing this: <xsl:variable name="UniqueId"> <xsl:number count="foo" level="any"/>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.