xsl structuring....

Subject: xsl structuring....
From: "Saif Khaja" <ksaif25@xxxxxxxxxxx>
Date: Mon, 02 Oct 2000 16:12:02 PDT
Hi everyone,
I am having a structuring problem with displaying the xml file in the format I want. Even though I think it must be a common one cause I came accross similar kind of structuring many times, but this time it is in XSL.

I have an XML file in this format.


/* ********************************************** */

Now my problem is to display it in the following format.

Name        desQty         asisQty
n1          10             20
n2          11             21
n3          12             22
n6          14             -
n7          15             -
n9          -              30

To achieve this, using the traditional sequential programming approach, I do the following. (Still hard to think in terms of structured - recursive approach.) :)

<xsl:for-each select="des/desRow"
 <xsl:variable name="desName" select="name"/>
 <TR><TD><xsl:value-of select="name"/></TD>
             <TD<xsl:value-of select="qty"/></TD>
 <xsl:for-each select="asis/asRow"
    <xsl:if test="$desName = name">
        <TD><xsl:value-of select="qty"/></TD>
 </xsl:for-each> </TR>

This <xsl:for-each> block will get all the common elements and new elements in "des".
And I am unable to think of a way to get the new elements in "asis". To get this if I write another FOR loop, with "asis" as outer loop, still I will have no way to determine that a match has been made and that it is a new element. How much I wish XSL had (actual)variables even though it has one. I would have used a flag and set it to true if a match was made and it would have solved my problem.

To get around this problem, I was thinking of another dumb way.
Is there any way you can change the XML from XSL?????????????
I was thinking of having a flag attribute for each "Row" and set it to true if a match has been made. But then I know it is not right as you are changing content for display.

Please, any suggestions towards this from the XSL gurus will be greatly appreciated.

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at http://profiles.msn.com.

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread