[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Folks,
First an example of the XML-Code:
This should be transformed to the following HTML-Code:
Best regards,
Michael
[xsl] Transforming XML-Groups to HTML-Lists
Subject: [xsl] Transforming XML-Groups to HTML-Lists From: Michael Ruck <lists@xxxxxxxx> Date: Thu, 14 Dec 2006 10:42:45 +0100 |
Hi Folks,
I try to transform XML-Tags which can combined as groups to HTML-Lists (ordered and unordered).
First an example of the XML-Code:
<EinzugListe> <Einzug aufz="1." level="0">Some Text 1 - Level 0</Einzug> <Einzug aufz="-" level="1">Some Text 1 - Level 1</Einzug> <Einzug aufz="-" level="1">Some Text 2 - Level 1</Einzug> <Einzug aufz="" level="1">Some more Text</Einzug> <Einzug aufz="-" level="2">Some Text 1 - Level 2</Einzug> <Einzug aufz="-" level="2">Some Text 2 - Level 2</Einzug> <Einzug aufz="2." level="0">Some Text 2 - Level 0</Einzug> </EinzugListe>
This should be transformed to the following HTML-Code:
<ol> <li>Some Text 1 - Level 0 <ul> <li>Some Text 1 - Level 1</li> <li>Some Text 2 - Level 1<br /> Some more Text <ul> <li>Some Text 1 - Level 2</li> <li>Some Text 2 - Level 2</li> </ul> </li> </ul> </li> <li>Some Text 2 - Level 0</li> </ol>
For the transformation I will use the following XSLT 2.0 code (without the decision if ul or ol):
<xsl:template match="EinzugListe"> <ul> <xsl:call-template name="ebene"> <xsl:with-param name="liste" select="Einzug"/> <xsl:with-param name="level" select="0"/> </xsl:call-template> </ul> </xsl:template> <xsl:template name="ebene"> <xsl:param name="liste"/> <xsl:param name="level"/> <xsl:for-each-group select="$liste" group-starting-with="*[xs:integer(@level) eq $level]"> <li> <xsl:value-of select="normalize-space(.)"/> <ul> <xsl:call-template name="ebene"> <xsl:with-param name="liste" select="current-group() except ."/> <xsl:with-param name="level" select="$level + 1"/> </xsl:call-template> </ul> </li> </xsl:for-each-group> </xsl:template>
I found the code in the List, modified it and it works fine until I will use Saxon as transform-processor which supports XSLT 2.0.
But the transformation has to be made on a Windows computer and there I only have the MSXML as transform-processor (because the transformation is part of an VBA-MSAccess2000-project). I read that MSXML does not (and will not) support XSLT 2.0 and so I am looking for a possibility to make the same transformation only with XSLT 1.0 functions. Or is there a possibility to use an other tranform-processor for the VBA-project (I read something about System.Xml, but I don't know how to include it in MSAccess2000 so I can use it in my VBA-project).
Thanks for your tipps, hints and code-samples (maybe including the decision if ul, ol or br (see example above))
Best regards,
Michael
---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] fo:external-graphic, SINGH Navpreet | Thread | [xsl] result-document, QNames, AVT', Abel Braaksma |
[xsl] fo:external-graphic, SINGH Navpreet | Date | [xsl] result-document, QNames, AVT', Abel Braaksma |
Month |
Keywords