[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] How do you change markup to text in XSLT?
Subject: [xsl] How do you change markup to text in XSLT? From: "Andrew Kane" <akane@xxxxxxxxxxxx> Date: Thu, 6 Sep 2001 10:52:45 -0400 |
Purpose: I was trying to put an XML subtree into an attribute, but it seemed like the default in XSLT was to extract the text from the subtree (similar to an xsl:value-of). I wanted the tags in there as well. Basically it boiled down to not being able to convert an XML subtree (markup) into text. I found some information on a tread on this list, and in the FAQ (see end of message for links), but it seemed to say you couldn't do it. If you change the markup to be text in the input (IE put it in a CDATA section) it works, but this doesn't allow dynamic XML subtrees... The only generic way I can see right now is to reconstruct the XML using templates, something like: <xsl:template match="*" mode="out"> <<xsl:value-of select="name()"/>> <xsl:apply-templates mode="out"/> </<xsl:value-of select="name()"/>> </xsl:template> With added functionality for outputting what you want (attributes, comment nodes, command nodes, etc). This is a horrible way to do it, is there another better/easier way? Cheers, Andrew. Thread on XSL List: http://www.biglist.com/lists/xsl-list/archives/199912/threads.html#00281 FAQ: http://www.dpawson.co.uk/xsl/sect2/N1553.html#d84e357 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] RE: Returning a Tree, Darren Hayduk | Thread | Re: [xsl] How do you change markup , David Carlisle |
RE: [xsl] Difference between preced, Michael Kay | Date | RE: [xsl] RE:what about [@this and , Michael Kay |
Month |