[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Generate key with further restriction

Subject: Re: Generate key with further restriction
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Mon, 08 Sep 2003 20:55:56 +0200
xsl generate key
Tim Müller-Seydlitz wrote:

Hi,
How can I generate keys with certain restrictions?
Would something like that
<xsl:key name="usedTypes" match="@*[name() = 'type' and not(starts-with(name(),'xs:'))]" use="." />
work to select those attributes with the name type that do not start with xs: ?
Yes. In fact, the "name() = 'type'" part will already take
care of this.

Do I need to take care of namespaces? How?
It depends what your requirements are.
The name() function returns the actually used name, including the
namespace prefix. The same element may be represented with different
names in a document, depending on namespace prefixes are bound.
Thgere is a local-name() function for returning the name without any
namespace prefix. You also have the namespace-uri() function (or
something similar, check the spec).

If you want to match attributes named "type" but not in the
"http://www.foo.bar/mumble" namespace, the following match
 match="@*[local-name()='type' and
  not(namespace-uri()='http://www.foo.bar/mumble')]"
should do the trick, regardless of the attribute prefix. It should
match 'type' attributes from every other namespace including the
default namespace (untested).

J.Pietschmann



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.