Re: [xsl] "uriref()" XPath function?

Subject: Re: [xsl] "uriref()" XPath function?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 15 Jun 2010 22:59:34 +0100
I notice there's an "idref()" XPath function which returns nodes which
reference a specified id

Actually, it's id() that does that - idref() does the inverse.

- however the document I'm processing
references ids with URIs, e.g.<a href="#foo"/>  references id "foo"

Theoretically, the document() function will do this. However, processing of fragment identifiers is a little fragile - technically it depends on the media type of the document being known, since the semantics of fragment identifiers depend on the media type. You might be better off using id(substring(@href, 2)).

Michael Kay

Current Thread