[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: positional grouping xslt2
This should get you started <xsl:template match="article"> <article> <xsl:for-each-group select="*" group-starting-with="head1"> <xsl:choose> <xsl:when test="self::head1"> <section> <head><xsl:copy-of select="self::head1/node()"/></head> <xsl:for-each-group select="current-group()[position()>1]" group-starting-with="head2"> <xsl:choose> <xsl:when test="self::head2"> <section2> <head><xsl:copy-of select="self::head2/node()"/></head> <xsl:for-each-group select="current-group()[position()>1]" group-adjacent="name()"> <xsl:choose> <xsl:when test="self::bull1"> <ul><xsl:copy-of select="current-group()"/></ul> </xsl:when> <xsl:when test="self::litem"> <ol><xsl:copy-of select="current-group()"/></ol> </xsl:when> <xsl:otherwise> <xsl:copy-of select="current-group()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </section2> </xsl:when> <xsl:otherwise> <xsl:copy-of select="current-group()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </section> </xsl:when> <xsl:otherwise> <xsl:copy-of select="current-group()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </article> </xsl:template> </xsl:stylesheet> $ saxon7 wiki.xml wiki.xsl <?xml version="1.0" encoding="UTF-8"?> <article> <section> <head> An Example Twiki Document</head> <hr/> </section> <section> <head> This is a level 1 heading A filler paragraph</head> <section2> <head> This is a level 2 heading A filler paragraph</head> <head3> And a level 3 heading. Never more than two linefeeds between content. Othewise it shows up as a paragraph!</head3> <p>A straightforward paragraph requires no special formatting. It can include <b>bold</b> text, <i>italic</i> text and <literal>monotype</literal> text. Note that bold and italic will be converted to docbook emphasis markup.</p> <p>Note that the star and underscore must be tight up to the marked up text, as per the wiki requirment</p> </section2> <section2> <head> Other markup.</head> <p>For lists, use </p> <ul> <bull1> Three spaces (not a tab) then the star</bull1> <bull1> Other List items then follow</bull1> <bull1> Third list item</bull1> </ul> <p>For ordered (itemised) lists,</p> <ol> <litem> ITem one</litem> <litem> item two</litem> <litem> and so on</litem> <litem>Note also that you only need add the number 1, not increment it each time.</litem> <litem>And that if you insert spaces after the number, they will be copied over.</litem> </ol> <p>Display lists, or definition lists, contain a term and its explanation. Three spaces followed by the dollar symbol prefix the term, the colon terminates the term and starts the definition. The newline terminates the definition</p> </section2> </section> </article> -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ 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
|