xsl-list
[Top] [All Lists]

Re: [xsl] Use of xsl:apply-templates exception with an element

2009-09-25 16:47:10
Hi Michael,

As "If you are confident that thenamespace URI makes no difference, then you can test using the predicate [local-name()!=$name]", then, isn't
<xsl:copy-of select="*(_at_)[name() = ($name1, $name2, $name3, $name4)]"/>
with stable prefixes, better than what Ken was proposing which might look like this: <xsl:copy-of select="*(_at_)[(local-name()=$name1 and namespace-uri()=$ns1) or (local-name()=$name2 and namespace-uri()=$ns2) or (local-name()=$name3 and namespace-uri()=$ns3) or (local-name()=$name4 and namespace-uri()=$ns4)]"/> ,
where I also have to declare variables $ns1, $ns2, $ns3, $ns4,
and where I also need to know, maintain, and debug the "hard-wired" fact that local-name $name1 is used with uri $ns1, and local-name $name2 is used with with uri $ns2, and local-name $name3 is used with uri $ns3, and local-name $name4 is used with uri $ns4, and ...

Thanks,
ac


I understand local-name and namespace uris, but isn't strange that you can use <xsl:copy-of select="*[(_at_)self::attribution]"/> but not <variable name="name" select=" 'attribution' "/> ...
<xsl:copy-of select="*[(_at_)self::{$name}]"/> for example.

Or similarily,
<xsl:copy-of select="*[(_at_)self::{(_at_)name}]"/>


It's only strange if you've somehow got it into your head that XSLT/XPath is
a macro language in which variables are inserted into expressions by textual
substitution before the expression is parsed and executed. Since that's a
completely erroneous view of the processing model, it's not surprising that
it leads you to false expectations.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay


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



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