|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: namespaces problem
At 2003-07-31 18:25 +0200, Marco Contardi wrote:
I have this xml (sample XMLSpy generate from xsd) Yes, this is a namespace problem. 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. You don't give any description of the content of your stylesheet, but for example, where you now probably have something along the lines of: <xsl:apply-templates select="Practica"/> ... <xsl:template match="Practica">... You will have to change this to: xmlns:ppztl="http://www.saga.it/egov/esicra/importazione/xml/esicra_pra" ... <xsl:apply-templates select="ppztl:Practica"/> ... <xsl:template match="ppztl:Practica">... 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@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ 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/s/bc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








