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

Re: Namespace problem

Subject: Re: Namespace problem
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 07 Jun 2010 11:57:10 +0200
Re:  Namespace problem
Lucas Miguez wrote:

I have a problem with the namespace of an XML file. The header of that
file is that:

<?xml version="1.0" encoding="windows-1252"?>
<AuditFile xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">

<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.00_01" xmlns:fo="
http://www.w3.org/1999/XSL/Format">
....

Well, the XSL file is not showing the values of the XML file. But if I
eliminate the namespace in the XML file
(xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.00_01") it works.

What is the correct way to declare that namespace in the XSL file?

With XSLT and XPath 1.0, to select and match elements in a namespace you need to bind a prefix to the namespace URI and use that prefix in your XPath expressions and match patterns to qualify element names


  <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:df="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"
    exclude-result-prefixes="df"
    version="1.0">

<!-- now use prefix "df" to qualify element names -->

    <xsl:template match="/df:AuditFile">
       <html>
         <body>
           <xsl:value-of select="df:Header/df:CompanyID"/>
         </body>
       </html>
    </xsl:template>



--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

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.