xsl-list
[Top] [All Lists]

Re: [xsl] how to avoid hardcoding xpath-default-namespace in xsl:stylesheet?

2014-04-12 04:54:34

On 11 Apr 2014, at 23:35, Larry Evans <cppljevans(_at_)suddenlink(_dot_)net> 
wrote:

Hopefully the compilation at the bottom of this
message  should make clear what I'm after.
But to be explicit, what do I put after

  xpath-default-namespace=

in the <xsl:stylesheet ... /> to retrieve the namespace used
in source document.


If you're writing a stylesheet and you don't know in advance what names are 
going to be used in the source document (whether it's the namespace part or the 
local part that you don't know), there are two solutions:

(a) use run-time name matching, e.g. match="*[local-name()=$X and 
namespace-uri()=$Y]"

(b) modify the stylesheet as soon as you do know the names, and then 
compile/execute the modified stylesheet.

Michael Kay
Saxonica


--~------------------------------------------------------------------
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>