W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2003

Re: processing with xsl

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Thu, 31 Jul 2003 07:13:37 -0400
Message-Id: <>
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>

XSLT and XPath questions would be better posted to the following list:


There are a number of subscribers who would enthusiastically respond to 
such questions.

There is also an *excellent* FAQ at:


At 2003-07-31 10:44 +0200, Marco Contardi wrote:
>I have this xml (sample XMLSpy generate from xsd)
><?xml version="1.0" encoding="UTF-8"?>
><?xml-stylesheet type="text/xsl" href="out_struttura_pra.xsl"?>
>       <Pratica>
>             <Id>2147483647</Id>
>             <Oggetto>HELLO</Oggetto>
>       </Pratica>
>I process the xml with the following xsl
><xsl:stylesheet version="1.0"
><xsl:template match="/">
>The problem is that it don't work,
>It work only when I delete the row "xmlns="http://....." from xml
>Any ideas please?

Unprefixed elements and attributes in XPath expressions address constructs 
only found in no namespace.  When you use the default namespace in an XML 
instance, your constructs are in a namespace even though there is no 
prefix.  Therefore, in your XPath instructions in XSLT you are obliged to 
use a prefix, even though there is no prefix in your XML instance.

Namespace processing is not based on the prefix used, it is based on the 
URI associated with the elements and attributes through various techniques 
of using prefixes and declaring associated namespace URI strings.

The reason your stylesheet works when you remove the default namespace 
declaration from your instance is because you are changing all of your 
elements from in a namespace to no namespace and your unprefixed XPath 
addresses find the constructs.  When you put the namespace declaration back 
in, you are adding the URI back onto the constructs and your unchanged 
XPath addresses can no longer find them.  You are obliged to add prefixes 
to your XPath address steps in your stylesheet.

I hope this helps.

.................. Ken

Upcoming hands-on courses: in-house corporate training available;
North America public:                     XSLT/XPath Aug 12, 2003

G. Ken Holman                mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:    http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/x/bc
Received on Thursday, 31 July 2003 07:13:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:02 UTC