View Single Post
  #2 (permalink)  
Old 06-10-2007, 05:36 PM
LDonaghe
Posts: n/a
Basically to insert the value of a node where a literal value would normally go you'll use the {} within the quoted string.

I don't know what the xml you're wanting to pull the id from is so I'll give you two examples.

1) the id is in a node:
source xml:
<root><mydivid>divMine</mydivid></root>
xslt:
<div id="{//root/mydivid}"></div>

2) the id is in an attribute:
source xml:
<root mydivid="divMine"></root>
xslt:
<div id="{//root/@mydivid}"></div>

Of course you can always declare an xsl:variable as well so that you don't have to use the whole xpath in the {}, or if you're in a template where the context is the parent node of the one that you're wanting to pull the id from you just use the name of the node or attribute in the {} (mydivid or @mydivid if your template's match="root").

Hopefully that's somewhat helpful!

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!