This is the mail archive of the
mailing list .
newbie problem - writing XSL for an XML with namespaces.
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] newbie problem - writing XSL for an XML with namespaces.
- From: "Simon Champion" <spudley99 at email dot com>
- Date: Tue, 03 Jul 2001 21:27:19 +0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
I'm still fairly new to this XML & XSL stuff, so please be patient with me. (I'm sure this is a really obvious question, but I'm absolutely stuck on it)
I have been given an XML document type to work with. It contains invoicing data, and our primary use for it will be passing it directly between two companies' software packages, but I also need to write XSLT stylesheets so that the same invoices can be viewed in a browser as well.
I've written an XSLT, which works well, but unfortunately it stops working as soon as I give it an XML that uses namespaces.
gives me an empty page.
I've been unable to find the reason why this is happening. Other than the namespace, the two documents were identical, and The XSLT doesn't reference any namespaces (other than it's own), so why does it choke when there's a namespace in the file.
Please can someone explain why it's not working for me, and how I can sort it out.
Many (many, many,...) thanks! :-)
MCS Ltd, Marlow, UK -- "Software for the Rental Industry"
Here is a cut-down version of my XSLT, including the relevant bits (this version doesn't include much data, but does demonstrate the effect):
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.0" omit-xml-declaration="yes" indent="yes"/>
<xsl:apply-templates select="//Invoice" mode="inv_no"/>
<xsl:template match="Invoice" mode="inv_no">
<xsl:param name="Style" select="'inv_no'"/>
<xsl:param name="Style" select="'supp_addr'"/>
<xsl:if test="string-length(.) > 0">
<xsl:value-of select="concat(.,' ')"/>
PS - This XSLT I'm writing has to be able to display the invoices coming from several different sources, which may or may not include the namespace details, so I need a solution that will work in both cases. (To further complicate the issue, the invoice may (or may not) be wrapped inside another XML type - SOAP, Biztalk, etc - in which case it would definitely require namespaces - multiple namespaces even - but I haven't got that far yet)
Make PC-to-Phone calls with Net2Phone.
Sign-up today at: http://www.net2phone.com/cgi-bin/link.cgi?121
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list