[xsl] Namespace match error. XSL to convert attribute-centric to element-centric.

Subject: [xsl] Namespace match error. XSL to convert attribute-centric to element-centric.
From: "Kerry, Richard" <richard.kerry@xxxxxxxxxxx>
Date: Thu, 15 Nov 2007 09:58:49 -0000
I'm trying to convert an xml document from attribute-centric to
element-centric using the following stylesheet.
(This is ConvertToElements2.xsl referred to below)


<xsl:template match="/">

<xsl:template match="@*" >
	<xsl:element name="{name()}">
		<xsl:value-of select=3D"."/>

<xsl:template match="*" >
	<xsl:element name="{name()}">
		<xsl:apply-templates select="@*" />


If I apply it to the following data :

<?xml version="1.0" encoding="UTF-8"?>
<slots xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	<slot name="RevMajor" use="yes" description="The Major Revision

I get an error as follows (this is using Saxon, on Windows XP):

(some lines of batchfile removed)

C:\Projects\Drivers\Mib>java net.sf.saxon.Transform Slots4.xml

Error at xsl:element on line 12 of
	XTDE0830: Undeclared prefix in element name: xsi Transformation
failed: Run-time errors were reported

I take it this error is due to the "xsi:" namespace of the
"xsi:noNamespaceSchemaLocation" attribute of my source data.
How can I handle this ?
I thought matching "*" would match everything. Do I need to tell it to
ignore namespaces ? Or match namespaces somehow ?
Or is this an XML error (wrong name for the schema attribute perhaps)
that is thus nothing to do with XSL ?


Richard Kerry
Colledia Control Engineer
Siemens IT Solutions and Services Ltd
Room 457 Design Building, BBC Television Centre, Wood Lane, London, W12
T: +44 (0)20 82259063 F: +44 (0)20 8576 8182 M: +44 (0)7921 244993
Email: richard.kerry@xxxxxxxxxxx
Website:  www.siemens.co.uk/it-solutions

This e-mail contains confidential information and is for the exclusive
use of the addressee/s.  If you are not the addressee, then any
distribution, copying or use of this e-mail is prohibited. If received
in error, please advise the sender and delete it immediately.  We accept
no liability for any loss or damage suffered by any person arising from
use of this e-mail.

Siemens IT Solutions and Services Limited
Registered No: 1203466 England
Registered Office: Faraday House, Sir William Siemens Square, Frimley,
Camberley, GU16 8QD

Current Thread