[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How do you change markup to text in XSLT?


Subject: RE: [xsl] How do you change markup to text in XSLT?
From: "Andrew Kane" <akane@xxxxxxxxxxxx>
Date: Fri, 7 Sep 2001 16:15:54 -0400


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mike Moran
> Sent: September 7, 2001 3:03 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] How do you change markup to text in XSLT?
>
>
> Andrew Kane wrote:
>
> > 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.
>
> [ ... ]
>
> Isn't this illegal in XML? I seem to remember either "<" or ">" being
> disallowed as attribute values.

"<" is illegal in XML attributes.  The only reason I can think of for this
is to ensure 'marked up' text  (or what appears to be marked up text)
doesn't appear in attributes.  This is kind of annoying for the xpath 'less
than' operator... but apparently using &lt; is valid in xpath (is that
universally true? From what I understand of XML parsers, the XSLT processor
won't even see the escaping, right?).

> Obviously you could escape them. However, why would you want to put an
> xml tree into an attribute value? Can't you put them in as elements?

I can't think of a good reason to do this when producing XML, but this
originally came to my attention for producing HTML.  Something along the
lines up putting marked up text into fields of an HTML form.  In any case,
exploring the limitations of XSLT is rather interesting in and of itself.


Andrew.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords