[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Child Nodes Problem
On 03/06/2010 11:46, Byomokesh Sahoo wrote:
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"> this test is always true as position() is always an integer greater than zero, for all documents. this would list the names of the attributes (in an arbitrary order) but your sample input has no attributes <xsl:value-of select="$delimiter"/>here you prpbably just want <xsl:text> </xsl:text> to insert a newline rather than a newline and some indentation space copied from the stylesheet. again this would list any attributes if you had them.</xsl:if> </xsl:if> <xsl:for-each select="@*"> <xsl:value-of select="."/> <xsl:value-of select="$delimiter"/> </xsl:for-each> The above for-each (which was the xslt 1 way) can be more simply written as<xsl:for-each select="*"> <xsl:value-of select="."/> <xsl:if test="position() != last()"> <xsl:value-of select="$delimiter"/> </xsl:if> </xsl:for-each> <xsl:value-of select="*" separator="$delimiter"/> again just use ,xsl:text> </xsl:text> if you want to insert just a new line and no spaces.<xsl:text> </xsl:text> David</xsl:for-each> </xsl:template> ________________________________________________________________________ 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. ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|