At 2006-03-08 20:35 +0100, M V wrote:
Given the document
<a/>
howe do I transform it to:
<b xmlns:h='http://foo'/>
T:\ftemp>type mv1.xml
<a/>
T:\ftemp>xslt mv1.xml mv1.xsl con
<?xml version="1.0" encoding="utf-8"?><b xmlns:h="http://foo"/>
T:\ftemp>type mv1.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="a">
<b xmlns:h='http://foo'/>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>
and given
<a xmlns:h='http://foo'/>
how do I transform it to:
<b>
<ns prefix='h' uri='http://foo'/>
</b>
T:\ftemp>type mv2.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<a xmlns:h='http://foo'/>
T:\ftemp>xslt mv2.xml mv2.xsl con
<?xml version="1.0" encoding="utf-8"?><b><ns prefix="h" uri="http://foo"/></b>
T:\ftemp>type mv2.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="a">
<b>
<xsl:for-each select="namespace::*[name(.)!='xml']">
<ns prefix="{name(.)}" uri="{.}"/>
</xsl:for-each>
</b>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>
I hope this helps.
. . . . . . . . . . . . Ken
--
Today is the last day of registration for next week's hands-on XSL courses.
--
Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-03-13/17
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
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>
--~--