If you don't want the namespace in the html output, add the attribute
'exclude-result-prefixes':
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ans="namespace_location" exclude-result-prefixes="ans" version="1.0">
Cheers,
<prs/>
-----Original Message-----
From: Narang, Prateek [mailto:PNarang(_at_)INNODATA-ISOGEN(_dot_)COM]
Sent: Wednesday, October 06, 2004 2:18 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] using XML elements as attributes in HTML
Seby, this xsl will give u the output u want.
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ans="namespace_location" version="1.0"> <xsl:template match="root">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="ans:color">
<font color="{normalize-space(.)}">
some text
</font>
</xsl:template>
</xsl:stylesheet>
Prateek Narang
Professional Services
Innodata Isogen
4th Floor, Gateway Tower
R Block, DLF City, Phase-III
Gurgaon, Haryana - 122 002
Phone: +(091) 124-2562801
Fax: +(091) 124-2356001
Cell: +(091) 9868350569
www.innodata-isogen.com
-----Original Message-----
From: Seby [mailto:Sebastian(_dot_)Krueger(_at_)mcs(_dot_)vuw(_dot_)ac(_dot_)nz]
Sent: Wednesday, October 06, 2004 11:46 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] using XML elements as attributes in HTML
Hey, hopefully someone will be able to help me out here.
Say I have an XML file like this:
<ans:color xmlns:ans="namespace_location">
green
</ans:color>
<ans:color xmlns:ans="namespace_location">
blue
</ans:color>
And I want to produce HTML like this:
<html>
<body>
<font color="green">
some text
</font>
<font color="blue">
some text
</font>
</body>
</html>
I think I do something like this:
<xsl:for-each select="/">
<font color="{{/namespace_location}color}">
some text
</font>
</xsl:for-each>
But it doesn't work! :'(
I must be wrong on the syntax I think.
Any help would be much appreciated.
Thanks, Seby.
-- Sebastian Krueger
-- 205 Aro St, Aro Valley, Wellington, New Zealand
-- Phone:+64 4 3844458
-- Mobile:+64 21 1781826
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--