[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Mapping via intermediate XML file problem

Subject: Mapping via intermediate XML file problem
From: "Lech Rzedzicki" <xchaotic@xxxxxxxxx>
Date: Tue, 1 Apr 2008 14:41:38 +0100
 Mapping via intermediate XML file problem
Hi.

I'm doing a simple transformation, substituting some tags with
different named ones and keeping the rest the same.
Since there are many strange cases, I'd like to keep the mapping in
the intermediate XML file (to keep the XSL clean), such as maps.xml:

<?xml version="1.0" encoding="UTF-8"?>
<maps>
    <map old="old-tag1" new="tag1"></map>
    <map old="old-strange-tag2" new="tag2"></map>
    <!-- <map old="" new=""></map> -->
</maps>

and then transform using:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

<xsl:variable name="maps" select="document('maps.xml')/maps/map"></xsl:variable>

<xsl:template match="*">
    <xsl:element name="{$maps[@old = local-name(current())]/@new}">
        <xsl:apply-templates select="node()|@*"/>
    </xsl:element>
</xsl:template>

</xsl:stylesheet>

But when I run that through Saxon 9B it says "Invalid element name.
Invalid QName {}" URL: http://www.w3.org/TR/xslt20/#err-XTDE0820

My source file contains both the elements matched by map and other elements too.

Any pointers deeply appreciated,

Lech

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.