[oXygen-user] XSLT and id() function
Linus Kamb
Wed May 23 17:31:26 CDT 2007
as is often the case, asking a question in a public forum usually helps one answer their own question...
couple of things I was doing wrong and/or could do differently.
First, bug in my xslt. I was asking for match="id(oid)" instead of the correct match="id($oid)"
that still requires having the id as an attribute defined in the dtd. when properly defined, that
works.
alternative is to use xsl:key and key() function.
this was probably not the right forum to post this in the first place.
sorry for the bandwidth.
cheers!
Linus Kamb wrote:
> trying to sort something out...
>
> XSLT (through XPath, I guess (http://www.w3.org/TR/xpath#function-id)
> has an id() function that, if I understand the docs correctly, will
> return the node (or nodeset, if the parameter is a nodeset of id
> strings) from the document that has the given id value.
>
> Great!
>
> Now, one problem. For that to work, apparently the id value needs to be
> declared as an attribute of ID type in a DTD. Bummer. See note in
> http://www.w3.org/TR/xslt#section-Embedding-Stylesheets.
>
> Ok, so I tried that, but Oxygen doesn't seem to find it.
>
> Does Oxygen (and/or XSLT in general, to your knowledge) support the id()
> function in XSLT? Can it work with an ID-typed element?
>
> My problem is that I am presented with an XML document that makes heavy
> use of IDREF type elements and I'm trying to transform them in XSLT.
> Perhaps there's a better way or I'm doing something wrong. Will post to
> xml dev list if this comes back negative.
>
> attached are my (hackish! just trying stuff out) xml, xsd, and xsl files
> I've been using to test. Note that in the xsl
>
> <xsl:variable name="onode" select="id(oid)"/>
> ids:<xsl:value-of select="$onode"/>
>
> "onode" is null (well, empty nodeset.)
>
>
> Thanks,
> Linus
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> oXygen-user mailing list
>
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
More information about the oXygen-user
mailing list