473,661 Members | 2,506 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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: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">
&lt;box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-1&gt;
<xsl:value-of select="$FieldT ypeNode[fieldTypeCode=$ minNode]/description"
/>
&lt;/box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e" />
</xsl:call-template>
<!--<xsl:number value="$num" format="a" />-->
-1&gt; &lt;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&gt;
<xsl:value-of
select="$Extens ionNode[fieldTypeCode=$ minNode]/reportableAmoun t" />
&lt;/box12
<xsl:call-template name="barney">
<xsl:with-param name="minNode" select="$minNod e" />
</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"?>
<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>

Jul 20 '05 #1
0 1878

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

Similar topics

0
2121
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 Code -------------------
3
1389
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 the XSLT processor I'm using (.net framework 1.1) it seems to return an empty string (or possibly an empty node set) I had a look here: http://www.w3.org/TR/xslt and I can't find any
3
1950
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> subsitutes the position of the node correctly as I expected. This is fine with MSXML 3.0 & MSXML 4.0 plus the XmlSpy internal engine. I have been able to reproduce using a simpler Xml and Xsl to demonstrate; XML
8
1373
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 different format. Here's an example of what the source XML looks like: - - - - begin source.xml - - - - <?xml version="1.0" encoding="UTF-8"?>
5
1289
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
1068
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 xsl:for-each. Each figure can contain different elements. This hickup is that each page in a figure has to have 2 numbering schemes. 1- The (page) of (total number of pages in the entire document pages)
0
1511
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 when checked would show student remarks and when unchecked would hide them. To do this I have made changes to the stylesheet. This is how the stylesheet is
2
1461
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" ?> <siteMap xmlns="http://schemas.microsoft.com/ASPNet/SiteMap-File-1.0" >
14
755
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"/> </xsl:variable> but with .Net framework 1.1 (using XPathDocument) it is very slow for
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.