xsl-list
[Top] [All Lists]

[xsl] RE: Template matching with multiple namespaces

2009-03-20 07:52:19

Tony,

You need to use the union operator, i.e.:

<xsl:apply-templates select=".//lml:LandXML | .//lml10:LandXML" />

Note that | is not an "or" operator - it creates a union of the two
nodesets. 

As a side note, use of // is inefficient - don't use it if you can avoid
it.

Laura.



------------------
Date: Fri, 20 Mar 2009 14:18:58 +1100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Tony Rowe" <tony(_dot_)rowe(_at_)listech(_dot_)com(_dot_)au>
Subject: Template matching with multiple namespaces
Message-ID:
<387B30B1FAC2384AB527E8AF1DDADC482E77E4(_at_)stimpy(_dot_)listech(_dot_)com(_dot_)au>

Hi,

I have a stylesheet which works with one namespace, prefix say 'lml'. I
now want the same stylesheet to work on documents under another
namespace, say lml10.

Here is my namespace defs...

<xsl:stylesheet version=3D"1.0"
 xmlns:lml=3D...
 xmlns:lml10=3D...
 xmlns:msxsl=3D...
 xmlns:xsl=3D"...


Now the stylesheet does, of course match nodes such as

<xsl:apply-templates select=3D".//lml:LandXML" />

But I want it to also match on

<xsl:apply-templates select=3D".//lml10:LandXML" />.

How can I set up some variable to allow me not to have to duplicate
code?

This doesn't work...NodeTest expected.
<xsl:apply-templates select=3D".//{$namespacevariable}:LandXML" />

Or is there a better way to get the one stylesheet to work over multiple
namespaces?

I am using XSLT 1.0 still because I need to use the MSXML parser 6.0.

Tony

------------------------------


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] RE: Template matching with multiple namespaces, Laura Porter <=