[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Extracting elements by parent
Joe Tseng schrieb: [...] What I want to achieve is 1) while looping through the batches print out all the associated elements and attributes of a batch 2) within a batch loop through the tests and print out all the associated parameters and associated elements and attributes of a test. [...]
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-templates select="batches/batch"/> </xsl:template> <xsl:template match="batch"> <xsl:value-of select="concat('### This is batch: ', @id)"/> <xsl:text> </xsl:text> <!-- newline; for Windows, use --> <xsl:apply-templates select="@* | description" mode="txt"/> <xsl:text> </xsl:text> <xsl:for-each select="tests/test"> <xsl:apply-templates select="."/> <xsl:text> </xsl:text> </xsl:for-each> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="test"> <xsl:value-of select="concat('--- This is test ', @id)"/> <xsl:text> </xsl:text> <xsl:apply-templates select="@* | description" mode="txt"/> <xsl:for-each select="params/p"> <xsl:apply-templates select="@* | ." mode="txt"/> </xsl:for-each> </xsl:template> <xsl:template match="@*|*" mode="txt"> <xsl:value-of select="concat( name(), ' : ', . , ' ' )"/> </xsl:template> </xsl:transform> Michael
|
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
|