This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Replacing a nested tag with another tag
- To: xsl-list at mulberrytech dot com
- Subject: Re: Replacing a nested tag with another tag
- From: "John E. Simpson" <simpson at polaris dot net>
- Date: Tue, 10 Oct 2000 21:38:09 -0400
- References: <001701c022d3$3e9aa560$0201010a@michaelnt2k>
- Reply-To: xsl-list at mulberrytech dot com
At 03:57 PM 10/10/2000 -0700, ajain@metreo.com wrote:
>...incoming XML:
>
><Intro>
>You are looking at
><Replace>
>RequestNumber
></Replace>
>Please click back to select another request number.
></Intro>
>
><RequestNumber>
>AG-190
></RequestNumber>
>
>
>I would like the output HTMLto be:
>
><p>
>You are looking at AG-190. Please click back to select another request.
></p>
>
>How can I implement the scenario above using XSLT?
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="text()"/>
<xsl:template match="/someroot">
<p>
<xsl:value-of select="normalize-space(Intro/text()[1])"/><xsl:text>
</xsl:text>
<xsl:value-of select="normalize-space(RequestNumber)"/>.
<xsl:value-of select="normalize-space(Intro/text()[2])"/>
</p>
</xsl:template>
</xsl:stylesheet>
(Note: I don't know what your root element is, hence the "/someroot" match
pattern.)
===============================================================
John E. Simpson | "He asked me if I knew what
http://www.flixml.org | time it was. I said, 'Yes, but
XML Q&A: http://www.xml.com | not right now.'" (Steven Wright)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list