Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Group processing / Muench method with MSXML or XSLT 1.0

From: Michael Ruck <lists@-------->
To:
Date: 1/2/2007 1:47:00 PM
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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent