Re: [xsl] Namespace problem

Subject: Re: [xsl] Namespace problem
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 07 Jun 2010 11:57:10 +0200
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="";
xmlns="urn:OECD:StandardAuditFile-Tax:PT_1.00_01" xmlns:fo="";>

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


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

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


	Martin Honnen

Current Thread