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

Fwd: Re: Fwd: Built-in *@ vs. node()

Subject: Fwd: Re: Fwd: Built-in *@ vs. node()
From: Janning Vygen <vygen@xxxxxx>
Date: Thu, 17 Oct 2002 11:05:43 +0200
vygen d sseldorf
Am Mittwoch, 16. Oktober 2002 17:22 schrieb Jeni Tennison:
> Hi Janning,
>
> > In my XML Book "In a nutshell" it says:
> > "node() matches all nodes regardless of type: attribute,
> > namespace..."
>
> It's true that the *node test* node() matches all nodes regardless
> of type. However, a node test never exists alone -- it's always
> used alongside an *axis*, for example:

oh yeah, i am a stupid guy. AXIS is the magic word!... Many thanks
for your detailed explanation below. I forgot my self-made rule when
dealing with XPATH:

"Dont use XPATH shorthands when it comes to problems" which leads
normally to question "What is your axis..." :-)
(my second best rule for XPATH is: try thinking in sets of nodes )

BTW: it is acommon fault in many documentations for beginners to
start with abbreviations of XPATH Expressions. I dont like them. In
XSLT you have to type a lot of things anyway. (ok i dont want to miss
them, but they just help you typing faster, not understanding faster,
but i guess thats common for all abbreviations :-)

thanks a lot.

kind regards,
janning

>   child::node()
>   attribute::node()
>
> The pattern "node()" is a shorthand for:
>
>   child::node()
>
> which matches all nodes *that are children of some other node*.
> Attributes are not children of any node, therefore this pattern
> doesn't match attributes. If you want to match attributes, you have
> to use the attribute axis, e.g.:
>
>   attribute::node()
>
> or:
>
>   attribute::*
>
> or their shorthands:
>
>   @node()
>   @*
>
> So the identity template is usually written:
>
> <xsl:template match="node() | @*">
>    <xsl:copy>
>       <xsl:apply-templates select="@* | node()"/>
>    </xsl:copy>
> </xsl:template>
>
> i.e. match all nodes-that-are-children and all attributes, copy
> them, and go on to process their attributes or children, if they
> have any.
>
> Cheers,
>
> Jeni
>
> ---
> Jeni Tennison
> http://www.jenitennison.com/

-----------------------
PLANWERK 6
websolutions

Herzogstraße 85
40215 Düsseldorf

fon 0211 - 601 606 93
fax 0211 - 601 591 7

vygen@xxxxxxxxxxxx
http://www.planwerk6.de
-----------------------

-------------------------------------------------------

-- 
Planwerk 6 /websolutions
Herzogstraße 86
40215 Düsseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

 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.