[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Use of xsl:apply-templates exception with an eleme
Subject: Re: Use of xsl:apply-templates exception with an element
From: ac <ac@xxxxxxxxxxxxx>
Date: Fri, 25 Sep 2009 20:00:26 -0400
|
Hi Wendell,
I like the except approach and if the intersection approach is namespace
safe, so should union, like:
select="(@name1 | @name2 | @name3 | @name4)"
Indeed we must have got tangled in XSLT 1.0 circumlocution,
although also, most examples were using variables rather than attributes.
For example, how to make
<xsl:copy-of select="@*[not(name() = ($new/@*/name()))]"/>
namespace safe in XSLT 2 ? as
<xsl:copy-of select="@* except ($new/@*)"/>
does not work, even if there are attributes that match in name (+
namespace) and value?
Thank you,
ac
ac,
At 04:45 PM 9/25/2009, you wrote:
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="*@[name() = ($name1, $name2, $name3, $name4)]"/>
with stable prefixes, better than what Ken was proposing which might
look like this:
<xsl:copy-of select="*@[(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 ...
Hm. "*@[name() = ($name1, $name2, $name3, $name4)]" uses XPath 2.0, so
why not use the 'except' operator?
select="@* except (@name1|@name2|@name3|@name4)"
which is namespace-safe?
(Didn't someone already suggest that?)
Ken's circumlocution reflects what you have to do in XSLT 1.0 to be
namespace-safe.
Cheers,
Wendell
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|