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

Re: Ugh! accessing current value in <A name= in template

Subject: Re: Ugh! accessing current value in <A name= in template
From: Aneel Nazareth <anazaret@xxxxxxxxxxxx>
Date: Tue, 03 Nov 1998 12:32:16 -0500
current id template
Amit Rekhi wrote:

> >The XSL rule should be:
> >
> ><xsl:template match="item/id">
> >  <TD><A name="id{.}">&#160;</A><xsl:process-children/></TD>
> ></xsl:template>
> >
>         This seems to be more of a "get around". I agree with Andrew, that
> there is may not be a facility in the XSL spec. to retrieve the element type
> name.
>         I feel ' name="id{.}" ' would point to an xml element with "id"
> attribiute(defined in the DTD maybe) = "." eg.
> .
> .
> <item id=".">

No. The Working Draft is clear on what this means: "id{.}" is a string with an
embedded attribute value template (2.7.11.3). {.} specifies a (select)
pattern, and . is a current node anchor. Since it matches an element node, the
value of the pattern "is computed by concatenating all characters that are
descendants of the element node" (2.7.11.1).

To get the behavior you describe, you would use an id anchor rather than a
current node anchor: "{id(name)}" would result in the contents of the element
that has an id attribute with the value of "name" (2.6.3.2, 2.4.2.1). I don't
think that "." is a legal id, since it's not an NCName (unless I'm wrong about
what constitutes a Unicode identifier character).
 
> rather than give us the elementtype name of the current node.
> I wish there was a such a mechanism in XSL

It's true that the code above doesn't give the tag name of the current node.
That's not what Glenn was asking for. I agree that such an ability could be useful.
begin:          vcard
fn:             Aneel Nazareth
n:              Nazareth;Aneel
email;internet: anazaret@xxxxxxxxxxxx
tel;work:       x234
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard

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.