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

Re: Child Nodes Problem

Subject: Re: Child Nodes Problem
From: Byomokesh Sahoo <sahoo.byomokesh@xxxxxxxxx>
Date: Thu, 3 Jun 2010 18:52:06 +0530
Re:  Child Nodes Problem
Yes David I have tried before <xsl:for-each select="//Product">. Still
I am missing <ProdIDT> <IDV> header and output also coming wrong. Both
tag value is close.

Output should be come

ProdIDT      IDV                   ProdIDT     IDV
02              1616200243         03           9781616200244

Please advise..

Thanks
Byomokesh



On Thu, Jun 3, 2010 at 4:31 PM, David Carlisle <davidc@xxxxxxxxx> wrote:
> On 03/06/2010 11:46, Byomokesh Sahoo wrote:
>
>>
>>  <xsl:variable name="delimiter" select="'&#9;'"/>
>>  <xsl:variable name="fieldNames" select="'yes'"/>
>>
>>  <xsl:template match="/">
>>
>>    <xsl:for-each select="//Product/child::*|//Product/self::*">
>
> That is the same as //Product/(.|*) although do you really need to search
> the entire document with // for product, or is it always at the top of your
> file. Your code below does for-each starting from here so it appears to be
> expecting to llop over the children of product, so i suspect this line
> should be
> <xsl:for-each select="//Product">
>
>
>>
>>      <xsl:if test="$fieldNames = 'yes'">
>>
>>        <xsl:if test="position() = 1 or position()&gt;1">
>
>   this test is always true as position() is always an integer greater than
> zero, for all documents.
>>
>>          <xsl:for-each select="@*">
>>            <xsl:value-of select="name()"/>
>
> this would list the names of the attributes (in an arbitrary order) but
your
> sample input has no attributes
>>
>>            <xsl:value-of select="$delimiter"/>
>>
>>          </xsl:for-each>
>>
>>          <xsl:for-each select="*">
>>            <xsl:value-of select="name()"/>
>>
>>            <xsl:if test="position() != last()">
>>              <xsl:value-of select="$delimiter"/>
>>            </xsl:if>
>>          </xsl:for-each>
>>          <xsl:text>
>>        </xsl:text>
>
> here you prpbably just want <xsl:text>&#10;</xsl:text>
> to insert a newline rather than a newline and some indentation space copied
> from the stylesheet.
>>
>>        </xsl:if>
>>      </xsl:if>
>>      <xsl:for-each select="@*">
>>        <xsl:value-of select="."/>
>>        <xsl:value-of select="$delimiter"/>
>>      </xsl:for-each>
>
> again this would list any attributes if you had them.
>>
>>      <xsl:for-each select="*">
>>        <xsl:value-of select="."/>
>>        <xsl:if test="position() != last()">
>>          <xsl:value-of select="$delimiter"/>
>>        </xsl:if>
>>      </xsl:for-each>
>
>         The above for-each (which was the xslt 1 way) can be more simply
> written as
> <xsl:value-of select="*" separator="$delimiter"/>
>
>>      <xsl:text>
>> </xsl:text>
>
> again just use ,xsl:text>&#10;</xsl:text> if you want to insert just a new
> line and no spaces.
>>
>>    </xsl:for-each>
>>  </xsl:template>
>>
> David
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________

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.