|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Recursively traversing an outline with level gaps
Dear Martynas,
This not the complete solution that you asked for, with lookups in styles.xml and with HTML generation, but at least it deals with outline gaps. I put it in a function that takes all your nodes and groups them by the lowest outline level number present (which corresponds to the highest hierarchy level...), and then recursively groups the groups by the next level that is available. You can also find it on http://github.com/gimsieke/oo2teilite-xslt2/blob/master/oo2teilite.xsl Gerrit <xsl:function name="letex:hierarchize-by-outline" as="node()*"> <xsl:param name="nodes" as="node()*" /> <xsl:param name="outline-level" as="xsd:double*" /> <xsl:choose> <xsl:when test="empty($outline-level)"> <xsl:sequence select="$nodes" /> </xsl:when> <xsl:otherwise> <xsl:for-each-group select="$nodes" group-starting-with="text:h[@text:outline-level = $outline-level]"> <xsl:choose> <xsl:when test="current-group()[1]/@text:outline-level = $outline-level"> <xsl:text>
</xsl:text> <div type="Heading_{$outline-level}"> <head> <xsl:copy-of select="current-group()[1]/node()" /> </head> <xsl:variable name="new-nodes" select="current-group()[position() gt 1]" as="node()*" /> <xsl:sequence select="letex:hierarchize-by-outline($new-nodes, min($new-nodes/@text:outline-level))" /> </div> </xsl:when> <xsl:otherwise> <xsl:sequence select="letex:hierarchize-by-outline(current-group(), min(current-group()/@text:outline-level))" /> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:otherwise> </xsl:choose> </xsl:function> On 24.03.2010 21:31, Martynas Jusevicius wrote: Sorry, you're right. I can make a simplified test case:
|
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








