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

Re: Whose axis am I?

Subject: Re: Whose axis am I?
From: quagly <quagly@xxxxxxxx>
Date: Mon, 03 Apr 2000 16:35:24 -0700
xsl match original tag attributes
"John E. Simpson" wrote:

> At 02:19 PM 04/03/2000 -0700, quagly wrote:
> ><xsl:template match="tag">
> >     <xsl:value-of select="@name"/>
> ></xsl:template match>
>
> [Aside: remove "match" from the end tag there.]
>
> Here, you're telling the processor "Whenever you encounter an element named
> 'tag' in the source tree, place into the result tree the value of its
> 'name' attribute." With two different tag elements, each of which has a
> different value for its name attribute, you get two different attribute values.
>
> But:
>
> ><xsl:template match="tag">
> >     <xsl:value-of select="../tag/@name"/>
> ></xsl:template match>
>
> [Aside: remove "match" from the end tag there.]
>
> If I may say, this is a rather bizarre select expression. The template
> match is identical to the previous one, e.g. "Whenever you encounter an
> element named 'tag' in the source tree...." But the select statement here
> is saying, "...then *back up to the parent of that 'tag' element*, get the
> child of that parent named 'tag' and place into the result tree the value
> of its 'name' attribute." What makes this bizarre is that of course the
> "tag" element doesn't have just ONE child named tag, it's got TWO. Since
> you can't get "THE attribute value" of "TWO tag elements' name attributes,"
> the processor is picking the value of the FIRST tag element's name
> attribute, no matter which of the original tag elements it's processing. (I
> ran this with XT and assume that other processors will do the same.)
>
> I haven't tested it, but I bet if you added 8 or 10 or 159 tag elements,
> you'd have "greedy" in the result tree that many times.
>

Thanks, this makes sense to me.

 The example is bizarre, it is just the simplest case I could think of that
 would demonstrate my confusion.  I have yet to post any of my actual work
as it does not illustrate any particular issue well, and would open me to public
humiliation, or at least a few jibes.

As you suspect, the number of greedies will equal the number of tag elements.
 "For each tag element go and get the attribute name of my parents first child."

Thanks to you.



 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.