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
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 ( {.} 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" (

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" (, 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