Re: How to add a "less than" or "greater than" sign?

Subject: Re: How to add a "less than" or "greater than" sign?
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Wed, 12 Apr 2000 15:57:55 -0400
At 01:44 PM 4/12/2000 -0500, Moazzam Ahmed wrote:
Im trying to create this as the output

<ATAG> myvalue </ATAG>

ATAG is an attribute value stored in TYPE

why wont this work

< <xsl:value-of select="@Type"> > myvalue </ <xsl:value-of select="@Type"> >

The reason it doesn't work is that the rules of XML itself forbid this kind of thing -- nothing really to do with XSLT. Since your stylesheet is itself an XML document, you can't double-up on the < and > characters within the stylesheet's tags any more than you can in any other XML document.


If, as I suspect, you're trying to create an element whose name depends on the value of an attribute, you might want to take a look at using xsl:element. This works something like the following (don't have an XSLT processor handy to test it):
<xsl:element name="@Type"> myvalue </xsl:element>
which places into the result tree an element named ATAG (*if* the value of the Type attribute is "ATAG"), which contains the string " myvalue ".


================================================================
John E. Simpson          | "After they make styrofoam, what do
http://www.flixml.org    | they ship it in?" (Steven Wright)
simpson@xxxxxxxxxxx      |



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


Current Thread