[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Getting Duplicate value while retrieving

Subject: RE: Getting Duplicate value while retrieving
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 18 Nov 2003 11:39:46 -0000
xsl duplicate values

> -----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() &gt; 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.