Re: XML to HTML conversion examples

Subject: Re: XML to HTML conversion examples
From: Miloslav Nic <nicmila@xxxxxxxxx>
Date: Thu, 11 May 2000 12:52:08 +0200
Eric van der Vlist wrote:
>

I personally find it more easily comprehensible. It looks natural to me 
1) create element
2) add attributes
3) create eventual subelements

The identity transformation is more elegant but difficult to mentally
grasp (my personal opinion).

I can see a slight advantage of my example that it frees match="@*" for
other uses, but I guess in most cases it does not matter. 

And I am of course biased because I quite often use similar constructs
to generate html print-out of xslt sources
and for something like this you cannot use copy, so to be honest when I
was replying to the
original question I did not think of identity transformation at all. 

> Miloslav Nic wrote:
> 
> > I you use html elements in the source I can recommend adding this
> > template to you stylesheet
> >
> > <xsl:template match="*">
> >   <xsl:element name="{name()}">
> >     <xsl:for-each select="@*">
> >       <xsl:attribute name="{name()}"><xsl:value-of
> > select="."/></xsl:attribute>
> >     </xsl:for-each>
> >     <xsl:apply-templates/>
> >   </xsl:element>
> > </xsl:template
> >
> Miloslav,
> 
> What about the classical identity transformation ?
> 
> <xsl:template match="@*|*">
>         <xsl:copy>
>                 <xsl:apply-templates select="@*|node()"/>
>         </xsl:copy>
> </xsl:template>
> 
> Do you consider it less readable, less portable or anything else ?
> 
> Thanks
> 
> Eric
> --
> ------------------------------------------------------------------------
> Eric van der Vlist       Dyomedea                    http://dyomedea.com
> http://xmlfr.org         http://4xt.org              http://ducotede.com
> ------------------------------------------------------------------------
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
***************************************
*** Miloslav Nic                    ***
*** mailto: nicmila@xxxxxxxxx       *** 
*** support: http://zvon.vscht.cz   ***
***************************************


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread