This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: XSL nested tag help
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Sat, 5 Oct 2002 17:26:49 +0100
- Subject: RE: [xsl] XSL nested tag help
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I've following XML file.
> <Main>
> This is a first test message
> <Target> and </Target>
> it is important
> </Main>
>
>
> From the above XML file I'd like to write and XSL so that I'll get
> following output
> <h1>This is a first test message<h1> <h2> and </h2> <h1>it is
> important
> </h1>
>
<xsl:template match="Main/text()">
<h1><xsl:value-of select="."/></h1>
</xsl:template>
<xsl:template match="Target">
<h2><xsl:value-of select="."/></h2>
</xsl:template>
But before you do that, try to choose a better design for your XML.
Using mixed content (text and elements as siblings of each other)
probably isn't the best approach here.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list