This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Replacing a nested tag with another tag


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]