Subject: RE: Getting Duplicate value while retrieving
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 18 Nov 2003 11:39:46 -0000
|
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> karthikeyan.balasubramanian
> Sent: 18 November 2003 10:18
> To: MulberryTech List
> Subject: Getting Duplicate value while retrieving
>
>
> Hi,
>
> I am not sure why I am getting duplicate values.
Because you are executing
<xsl:value-of select="../following-sibling::*[1]"/>
when the context node is an ENTRY/PARA, so ../following-sibling::*
selects the next ENTRY, and its string value is the concatenation of all
the text nodes contained in that ENTRY.
Michael Kay
>
> I tried all permutation/combinations.
>
> Output Expected
> ------------------
>
> A2873-300
> 36 11 49 01 150 1
> A3122-8
> 26 12 01 02 012 3
> VN936NP9C
> 71 21 00 01 190 2
> 71 21 00 01A 100 2
> 71 21 11 01 440 2
>
> Current Output
> -----------------
>
> A2873-300
> 36 11 49 01 150 1
> A3122-8
> 26 12 01 02 012 3
> VN936NP9C
> 71 21 00 01 190 222
> 71 21 00 01A 100 222
> 71 21 11 01 440 222
>
> XML Content
> ---------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="karthik_test1.xsl"?>
> <NI PUBLISH="SEP 01/03">
> <HEADER>
> <PARA>ipc</PARA>
> <PARA>COMPONENT MAINTENANCE MANUAL</PARA>
> </HEADER>
> <TABLE>
> <THEAD>
> <ROW>
> <ENTRY>
> <PARA>PART NUMBER</PARA>
> <PARA>CH SECT UNIT FIG ITEM</PARA>
> <PARA>TTL. REQ.</PARA>
> </ENTRY>
> <ENTRY>
> <PARA>AIRLINE PART NO.</PARA>
> </ENTRY>
> </ROW>
> </THEAD>
> <TBODY>
> <ROW>
> <ENTRY>
> <PARA>A2873-300</PARA>
> <PARA>36 11 49 01 150</PARA>
> </ENTRY>
> <ENTRY>
> <PARA/>
> <PARA>1</PARA>
> </ENTRY>
> </ROW>
> <ROW>
> <ENTRY>
> <PARA>A3122-8</PARA>
> <PARA>26 12 01 02 012</PARA>
> </ENTRY>
> <ENTRY>
> <PARA/>
> <PARA>3</PARA>
> </ENTRY>
> </ROW>
> <ROW>
> <ENTRY>
> <PARA>VN936NP9C</PARA>
> <PARA>71 21 00 01 190</PARA>
> <PARA>71 21 00 01A 100</PARA>
> <PARA>71 21 11 01 440</PARA>
> </ENTRY>
> <ENTRY>
> <PARA/>
> <PARA>2</PARA>
> <PARA>2</PARA>
> <PARA>2</PARA>
> </ENTRY>
> </ROW>
> </TBODY>
> </TABLE>
> </NI>
>
> XSL Content
> -----------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format">
> <xsl:template match="NI">
> <xsl:for-each select="TABLE/TBODY/ROW">
> <table border="1">
> <tbody>
> <tr>
> <td>
> <xsl:value-of select="ENTRY[1]/PARA[1]"/>
> </td>
> <td>
> <xsl:value-of select="ENTRY[2]/PARA[1]"/>
> </td>
> </tr>
> <xsl:for-each select="ENTRY[1]/PARA">
> <xsl:if test="position() > 1">
> <tr>
> <td>
> <xsl:value-of select="."/>
> </td>
> <td>
> <xsl:value-of select="../following-sibling::*[1]"/>
> </td>
> </tr>
> </xsl:if>
> </xsl:for-each>
> </tbody>
> </table>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> Any suggestions?
>
> Have a great day.
>
> Karthikeyan B
>
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|