[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
Amit Rekhi wrote: > >The XSL rule should be: > > > ><xsl:template match="item/id"> > > <TD><A name="id{.}"> </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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|