Abhijit,
It looks like you are trying to generate entity references on the fly,
which is against the XSLT processing paradigm. Entities are part of XML
considered as a lexical object (string of characters including markup),
whereas XSLT operates on XML considered as a parsed data object (a tree of
nodes). Once the document has been parsed into this tree, all entities have
been resolved. Likewise, most XSLT serializers do not provide any means for
generating entity references instead of the whatever-it-is that they refer to.
Since most XSLT processors can serialize their output, however (i.e., since
most, in practice, write their output as marked-up text to a file), there
is a workaround that *may* be available to you.
So instead of
<xsl:template match="node2">
&<xsl:value-of select="@attr/>;
</xsl:template>
try
<xsl:template match="node2">
<xsl:text disable-output-escaping="yes">&</xsl:text>
<xsl:value-of select="@attr/>;
</xsl:template>
and see if it works better for you.
Note that is ONLY works if your XSLT transformation is directly followed by
a serialization (i.e. you are writing your output as a stream of characters
somewhere), and if your processor implements this optional feature of the
language.
It will NOT work in many pipeline architectures or in some processors that
are built to ply the straight-and-narrow, such as the Transformiix
processor used in Mozilla.
So beware! this is a trick you should use knowing the risks.
-- Wendell
At 06:13 PM 11/10/2003, you wrote:
Hi,
I am using xsl for xml to xml tranformation. I want to
pring & character in my output xml....
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list