|
Subject: RE: [xsl] [XSLT 1.0] Replace namespace prefixes? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 24 Dec 2009 13:14:49 -0500 |
Ken Holman gave this solution to the "replace prefixes problem":
T:\ftemp>xslt roger.xml roger4.xsl con
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :book
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :title
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :author
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :date
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :ISBN
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :publisher
Recoverable error
at xsl:element on line 10 of file:/T:/ftemp/roger4.xsl:
Invalid element name: :cost
Recoverable error
at xsl:attribute on line 19 of file:/T:/ftemp/roger4.xsl:
Cannot write an attribute node when no element start tag is open
<?xml version="1.0" encoding="utf-8"?>
The Origin of Wealth
Eric D. Beinhocker
2006
1-57851-777-X
Harvard Business School Press
29.95T:\ftemp>type roger.xml <attackNOW:book xmlns:attackNOW="http://www.book.org"> <attackNOW:title>The Origin of Wealth</attackNOW:title> <attackNOW:author>Eric D. Beinhocker</attackNOW:author> <attackNOW:date>2006</attackNOW:date> <attackNOW:ISBN>1-57851-777-X</attackNOW:ISBN> <attackNOW:publisher>Harvard Business School Press</attackNOW:publisher> <attackNOW:cost currency="USD" attackNOW:other="x">29.95</attackNOW:cost> </attackNOW:book>
<xsl:template match="*[namespace-uri(.)]">
<xsl:element name="{$use-this-prefix}{local-name()}"
namespace="{namespace-uri(.)}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template><xsl:template match="@*[namespace-uri(.)]">
<xsl:attribute name="{$use-this-prefix}{local-name()}"
namespace="{namespace-uri(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template><xsl:template match="@*|node()"><!--identity for all other nodes-->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
-- UBL and Code List training: Copenhagen, Denmark 2010-02-08/10 XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] [XSLT 1.0] Replace namesp, Costello, Roger L. | Thread | RE: [xsl] [XSLT 1.0] Replace namesp, G. Ken Holman |
| RE: [xsl] [XSLT 1.0] Replace namesp, Costello, Roger L. | Date | RE: [xsl] [XSLT 1.0] Replace namesp, G. Ken Holman |
| Month |