[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] remaining part of( IF-Test...continued )


Subject: Re: [xsl] remaining part of( IF-Test...continued )
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Tue, 12 Mar 2002 20:05:35 +0100

> My problem is the <book> element gets eliminated in
> the output altogether.

No, you never can "eliminate" any node. You must bear in mind that there is
a difference between the input tree and the output tree. If you want to copy
the <Book> from the input to the output, then you have to tell it to the
processor:

<xsl:template match="Book">
    <!-- copy <Book> -->
    <xsl:copy>
        <!-- copy all attributes -->
        <xsl:copy-of select="@*"/>
        <!-- if no @ISBN add @NOCODE -->
        <xsl:if test="not(@ISBN)">
            <xsl:attribute name="NOCODE">
                <xsl:text>B01</xsl:text>
            </xsl:attribute>
        </xsl:if>
    </xsl:copy>
</xsl:template>

Regards,

Joerg


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



Current Thread