Re: [xsl] I mean self::* doesn't select attributes :(

Subject: Re: [xsl] I mean self::* doesn't select attributes :(
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Apr 2001 16:56:27 -0400
At 01/04/24 13:24 -0700, Evan Lenz wrote:
Anyone else have headaches with not being able to do @*[not(self::xyz:* or
self::abc:*)] ?

Anything more elegant than the following two solutions?

@*[not(namespace-uri()='&xyzURI;' or namespace-uri()='&barURI;')]

@*[not(generate-id()=generate-id(../@xyz:*) or

I'd love to be missing something.

This is an excerpt from pages 182/183 of my book:

  Practical Transformation Using XSLT and XPath
  (XSL Transformations and the XML Path Language)
  Ninth Edition - 2001-01-19 - ISBN 1-894049-06-3
  Copyright (c) 2001 Crane Softwrights Ltd.
  / 375 Pages / Subscription price includes free updates
  /           / and separate copy of all example files.
  /           / Free 137-page download preview excerpt.

These pages describe the way to do a test of the current node as being one of every node type of XPath ... the following are the attribute tests I suggest for the current node:

                <--specific namespaced-unqualified attribute-->
    <xsl:when test="count(.|../@version)=count(../@version)">
      <xsl:text>version attribute </xsl:text>
                  <!--specific namespace-qualified attribute-->
    <xsl:when test="count(.|../@book:ref)=count(../@book:ref)">
      <xsl:text>book:ref attribute </xsl:text>
                                           <!--any attribute-->
    <xsl:when test="count(.|../@*)=count(../@*)">
      <xsl:text>attribute </xsl:text>

The use above of the XPath axes handles the prefix/URI issue.

I hope this helps.

....................... Ken

-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML/OmniMark services, training, products. Book: Practical Transformation Using XSLT and XPath ISBN 1-894049-06-3 Article: What is XSLT? Next public instructor-led training: 2001-05-01,05-14,05-15,05-16, - 05-17,05-21,05-22,06-18,06-21,07-20,07-21,09-19

Training Blitz: 3-days XSLT/XPath, 2-days XSLFO in Ottawa 2001-06-18/22

XSL-List info and archive:

Current Thread