|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: outputting mutiple html files
Hi David,
When you match a session you can apply the templates further only on the elements following the current session until the next session element instead of the elements inside the current session element. Assuming the following input document: <?xml version="1.0" encoding="UTF-8"?> <test> <section>section one</section> <para>para1</para> <para>para2</para> <section>section two</section> <para>para3</para> </test> then the following stylesheet <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:apply-templates select="test/section"></xsl:apply-templates> </xsl:template> <xsl:template match="section"> <!-- create section file file --> section <xsl:variable name="sid" select="generate-id(.)"/> <xsl:apply-templates select="following-sibling::*[name()!='section' and generate-id(preceding-sibling::section[1])=$sid]"/> </xsl:template> <xsl:template match="para">
<xsl:value-of select="."/>
</xsl:template></xsl:stylesheet> will get as output: section
para1para2 section
para3
David Elsmore wrote: I want to transform an xml file, outputting separate sections into multiple html documents. If the xml was srtructured as follows I would have no problem, I could simply use <xsl:for-each select="section">
|
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
|

Cart








