forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Koberg" <...@koberg.com>
Subject Re: import of xml.apache.org main site into forrest
Date Wed, 05 Jun 2002 14:25:00 GMT

----- Original Message -----
From: "Steven Noels" <stevenn@outerthought.org>


> > From: Bert Van Kets [mailto:bert@vankets.com]
>
> > An alternative is
> >
> > <xsl:template match"/">
> >    <xsl:copy-of>
> >      <xsl:value-of select="."/>
> >    </xsl:copy-of>
> > </xsl:template>
> >
> > This copies the complete root node to the output incl.
> > attributes and children.
>
> ... but doesn't allow you to specify any other templates for particular
> patterns underneath the root node, since this template will bypass all
> other templates that could affect the output tree. I teach this in my
> courses as being a bad practice, do you guys have any thoughts on this?
>
> </Steven>

Sure it does. Why is it a bad practice? This matches everything except what
is specified:

<xsl:template match="content">

    <xsl:copy>
        <xsl:copy-of select="@*"/>

        <xsl:if test="@id=$folder_idref">
            <art_xml label="{$label}" id="{$id}" lock="{$lock}"
status="{$status}"/>
        </xsl:if>

        <xsl:apply-templates/>

    </xsl:copy>


</xsl:template>

<xsl:template match="node()|@*">

    <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates/>
    </xsl:copy>

</xsl:template>


Mime
View raw message