Hi folks,
This will probably sound very very newbie, but I am an XSLT newb...
Say I have my XML file like so:
and I have an XSL template something like this....Code:<myxml> <content> <heading>Heading 1</heading> <subheading>Heading 2</subheading> <paragraph>This is some content. Foo bar, foo bar, foo bar...</paragraph> <paragraph>Wooo another paragraph! This is getting repetitive...</paragraph> <heading>Another Heading 1</heading> <paragraph>YEAH!!!!!!!!!! Oh, right...</paragraph> </content> </myxml>
Now, I realise that will chuck out 2 <h1> tags followed by one <h2> tag and then my 3 <p> tags.... but how do I get them 'chucked out' in the order in which they appear in the XML file??Code:<xsl:for-each select="heading"> <h1><xsl:value-of select="heading"></h1> </xsl:for-each> <xsl:for-each select="subheading"> <h2><xsl:value-of select="subheading"></h2> </xsl:for-each> <xsl:for-each select="paragraph"> <p><xsl:value-of select="paragraph"></p> </xsl:for-each>
Hope that makes sense... sorry for the poor example.




Reply With Quote