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

Re: Looping a node in XSLT

Subject: Re: Looping a node in XSLT
From: Senthilkumaravelan Krishnanatham <senthil@xxxxxxxxx>
Date: Tue, 6 Mar 2007 16:13:29 -0800
Re:  Looping a node in XSLT
I have tried the same and hard time figuring out the syntax.

    <products>
        <customer>
            <email>senthil@xxxxxxxxx</email>
            <first_name>Senthil</first_name>
            <last_name>K</last_name>

            <PRODUCT_NAME1>MAc
</PRODUCT_NAME1>
            <GREETINGS>Hello
</GREETINGS>

        </customer>
    </products>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform">
<xsl:output method="xml" omit-xml-declaration="no" indent="yes" encoding="UTF-8" />
<xsl:template match="/products">
<xsl:copy>
<xsl:call-template name="COPY">
</xsl:call-template>
</xsl:copy>
</xsl:template>
<xsl:template name="COPY">
<xsl:variable name="n" select="10" />
<xsl:for-each select="1to$n">
<xsl:copy>
<xsl:apply-templates select="//customer/*"/>
</xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


On Mar 6, 2007, at 4:02 PM, Abel Braaksma wrote:

Senthilkumaravelan Krishnanatham wrote:
How do I retain the structure of the sibling node?

Please show us first what you tried so far, just out of thin air it is hard guessing.


Inside these "loops" you can use whatever XSLT or XPath you like. Not sure what you mean by "structure", but if you mean "the same structure as you had when you were doing it one loop", just move your current code the location of the loop and you are done.

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-2007 All Rights Reserved.