[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Replacing a nested tag with another tag

Subject: Re: Replacing a nested tag with another tag
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Tue, 10 Oct 2000 21:38:09 -0400
replace nested tags xsl
At 03:57 PM 10/10/2000 -0700, ajain@xxxxxxxxxx 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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.