Subject: [xsl] sorting and numbering From: Eric Smith <Eric.Smith@xxxxxxxxxxxx> Date: Sun, 25 Nov 2001 01:02:48 +0100 |
I am able to sort and do multi-level numbering with code as following but cannot get both do work appropriately at the same time. The faq have examples for this but they all seem (needlessly) complicated to me. The problem with the xsl as below is a) drops the first level of numbering (this happens as soon as you add the for-each loop. b) once properly ordered on the attribute, the numbering follows the document order and not the sorted order. <!--START style content--> <xsl:template match="body"> <xsl:for-each select="para[@order]"> <xsl:sort select="@order"/> <xsl:apply-templates/> </xsl:for-each> </xsl:template> <xsl:template match="para"> <xsl:number level="multi" format="1."/> <xsl:apply-templates/> </xsl:template> <!--END style content--> <!--START XML content--> <body> <para order="2"> C This is number 2 <para> I am one in C </para> <para> I am two in C </para> </para> <para order="1"> B This is number 1 <para> I am also one in B </para> <para> I am two in B </para> <para> I am three in B </para> </para> <para order="3"> A This is number 3 <para> I am three </para> </para> </body> <!--END XML content--> =============== As a final issue but not crucial issue, I would like to be able to have ordering and numbering for <body> <para order="2"> C This is number 2 <para> <subpara> Some text </subpara> <subpara> Some text </subpara> <para order="1"> C This is number 1 <para> <subpara> Some text </subpara> </body> -- Eric Smith - currently using xalan and fop on linux XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] dynamic grouping of tabul, Dan Diebolt | Thread | Re: [xsl] sorting and numbering, Jörg Heinicke |
RE: [xsl] dynamic grouping of tabul, Chris Bayes | Date | RE: [xsl] dynamic grouping of tabul, Dan Diebolt |
Month |