This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: cascading tags
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 17 Jan 2002 10:49:45 +0100
- Subject: Re: [xsl] cascading tags
- References: <004e01c19f37$44aa1760$0300a8c0@DASEPPM>
- Reply-to: xsl-list at lists dot mulberrytech dot com
----- Original Message -----
From: "Andreas Putscher" <andreasputscher@gmx.at>
> Hi everybody,
> I am a newbie in XSLT.
> The following is my problem:
>
> I have an XML inputfile that I want to transform into another XML file:
>
> a scratch of the inputfile:
>
> <bulletlist>
> <item>there are two different levels of compliance for XML documents:
> <numberedlist>
> <item>the well-formedness of an XML document</item>
> <item>the validityof an XML document</item>
> </numberedlist>
> </item>
> </bulletlist>
>
> I would like to transform this file into:
>
> <p>there are two different levels of compliance for XML documents:
> <p>the well-formednessof an XML document</p>
> <p>the validityof an XML document</p>
>
> If I use the following transformation codes
>
> <xsl:template match="bulletlist/item">
> <p><xsl:text>- </xsl:text>
> <xsl:apply-templates/></p>
> </xsl:template>
>
> <xsl:template match="numberedlist/item">
> <p><xsl:number value="position()" format="1. "/><xsl:value-of
> select="text()" /></p>
> <xsl:apply-templates/>
> </xsl:template>
>
> I get
>
> <p>- there are two different levels of compliance for XML documents:
> <p>1. the </p>the well-formedness of an XML document
> <p>2. the </p>the validity of an XML document</p>
>
>
> which is an invalid document.
> How do I have to change my statement, so that it works.
>
> Thanks for your help,
> Andreas
Hi Andreas,
the output is no invalid XML, so it's correct in theory. But you want
something else, so change the first template
> <xsl:template match="bulletlist/item">
> <p><xsl:text>- </xsl:text>
> <xsl:apply-templates/></p>
> </xsl:template>
to
<xsl:template match="bulletlist/item">
<p><xsl:text>- </xsl:text></p>
<xsl:apply-templates/>
</xsl:template>
Regards,
Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list