Subject: [xsl] problem with preceding axis From: kalpana rawat <kal_xml@xxxxxxxxx> Date: Wed, 10 Oct 2001 10:23:25 -0700 (PDT) |
Could anybody tell me how to solve this problem. My problem is that I use [not(@ID=preceding::Document/@ID)] which protects the next Documents, having same ID, to be displayed but I can't avoid writing [not(@ID=preceding::Document/@ID)] also. XML is: <Item Type="Annual" ID="2701"> <Title><![CDATA[Item 2.2 title]]></Title> <Attr ID="1"> <Name>X</Name> <Year Value="1999"> <Document ID="1" Title="Doc 1"> <Value>Doc 1 Value of Year 1999 attr X</Value> </Document> <Document ID="2" Title="Doc 2"> <Value>Doc 2 Value of Year 1999 attr X</Value> </Document> </Year> <Year Value="2000"> <Document ID="1" Title="Doc 1"> <Value>Doc 1 Value of Year 2000 attr X</Value> </Document> <Document ID="2" Title="Doc 2"> <Value>Doc 2 Value of Year 2000 attr X</Value> </Document> </Year> </Attr> <Attr ID="2"> <Name>Y</Name> <Year Value="1999"> <Document ID="1" Title="Doc 1"> <Value>Doc 1 Value of Year 1999 attr Y</Value> </Document> <Document ID="2" Title="Doc 2"> <Value>Doc 2 Value of Year 1999 attr Y</Value> </Document> </Year> <Year Value="2000"> <Document ID="1" Title="Doc 1"> <Value>Doc 1 Value of Year 2000 attr Y</Value> </Document> <Document ID="2" Title="Doc 2"> <Value>Doc 2 Value of Year 2000 attr Y</Value> </Document> </Year> </Attr> </Item> XSL is: <xsl:for-each select="Attr"> <table width="98%" border="1" cellpadding="4" cellspacing="0" align="center"> <tr> <td class="cssheader11"> <xsl:value-of select="Name" disable-output-escaping="yes"/> </td> <xsl:for-each select="Year"> <td class="cssheader11"> <xsl:value-of select="@Value" disable-output-escaping="yes"/> </td> </xsl:for-each> </tr> <xsl:for-each select="Year/Document[not(@ID=preceding::Document/@ID)]"> <xsl:variable name="varDocID" select="@ID" /> <xsl:variable name="varYear" select="../@Value" /> <tr> <td class="cssbody11"> <xsl:value-of select="@Title" disable-output-escaping="yes"/> </td> <xsl:for-each select="../../Year/Document[@ID=$varDocID]/Value"> <td class="cssbody11"> <xsl:value-of select="." disable-output-escaping="yes"/> </td> </xsl:for-each> </tr> </xsl:for-each> </table><BR/><BR/> </xsl:for-each> output: <table align="center" cellspacing="0" cellpadding="4" border="0" width="98%"> <tr> <td class="cssbody12blue"><a name="2701"><b>Item 2.2 title</b></a></td> </tr> </table> <table align="center" cellspacing="0" cellpadding="4" border="1" width="98%"> <tr> <td class="cssheader11">X</td><td class="cssheader11">1999</td><td class="cssheader11">2000</td> </tr> <tr> <td class="cssbody11">Doc 1</td><td class="cssbody11">Doc 1 Value of Year 1999 attr X</td><td class="cssbody11">Doc 1 Value of Year 2000 attr X</td> </tr> <tr> <td class="cssbody11">Doc 2</td><td class="cssbody11">Doc 2 Value of Year 1999 attr X</td><td class="cssbody11">Doc 2 Value of Year 2000 attr X</td> </tr> </table> <BR> <BR> <table align="center" cellspacing="0" cellpadding="4" border="1" width="98%"> <tr> <td class="cssheader11">Y</td><td class="cssheader11">1999</td><td class="cssheader11">2000</td> </tr> </table> Thanks __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] validating a schema at ru, Jeni Tennison | Thread | Re: [xsl] problem with preceding ax, Jeni Tennison |
RE: [xsl] Re: Overlapping structure, Mark Nahabedian | Date | Re: [xsl] keys and idrefs - XSLT2 r, Colin Paul Adams |
Month |