[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Building a Manual with XML/XSL
Hi Ivan, Assuming you would have sub1, sub2 and sub3 as maximum depth (i.e. 3) of *sub tags*, I suggest the following XSL -- <xsl:for-each select="chapter"> <xsl:for-each select="sub1"> <h1><xsl:value-of select="@title"/></h1> <xsl:for-each select="para"> <p><xsl:value-of select="."/></p> </xsl:for-each> <xsl:for-each select="sub2"> <h2><xsl:value-of select="@title"/></h2> <xsl:for-each select="para"> <p><xsl:value-of select="."/></p> </xsl:for-each> <xsl:for-each select="sub3"> <h3><xsl:value-of select="@title"/></h3> <xsl:for-each select="para"> <p><xsl:value-of select="."/></p> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:for-each> <hr/> <!-- you may write a horizontal line after each chapter --> </xsl:for-each> If you have sub4, sub5 etc, you may nest more for-each loops .. Regards, Mukul --- Iván_Montoro_Ten <ivanm@xxxxxxxxxxx> wrote: > Hi everybody, > > This is my very first post to the list, so please > forgive me if > I'm writing to the wrong place (and also forgive my > poor english!) > > I'm building several manuals with XML for a product > we make. I've > seen several frameworks for it, but I'm looking for > something > easier, as a bare XML file and a XSL HTML transform > (maybe later > I'll get PDF, but that's too much for me right now!) > > So, in the following scenario: > ------------------------------------------------------------ > <manual> > <chapter title="Begining with..."> > <sub1 title="To start..."> > <para>text text text</para> > <sub2 title="What you need"> > <para>text text text</para> > </sub2> > <sub2 title="Doing it well"> > <para>text text text</para> > <sub3 title="Don't forget..."> > <para>text text text</para> > </sub3> > <para>text text text</para> > </sub2> > </sub1> > </chapter> > </manual> > ------------------------------------------------------------ > I've the basic skeleton for my document. I want XSL > to transform > this in a basic <P></P>, <H1></H1>, <H2></H2> > structure, but > I don't know how to iterate the subelements > linearly, rather I > know how to xsl:for-each them. Is there any solution > for this? > > Thanks! > > Ivan Montoro > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|