how to access base URI in extension function?
Added by Anonymous about 19 years ago
Legacy ID: #3365572 Legacy Poster: Kevin Rodgers (notorious_kev)
I'm attempting to write my first extension function, which takes a URL as an argument. I want it to handle relative URLs correctly, so I've copied the code from the readFile method in UnparsedText.java to do that. But I don't see how to access the base URI from my extension function's XPathContext argument. I see that UnparsedText is a subclass of SystemFunction, which gives it access to a StaticContext object and thus its baseURI, but it doesn't seem right for an extension function class to be a subclass of SystemFunction. Thanks for helping a newbie, -- Kevin
Replies (1)
RE: how to access base URI in extension funct - Added by Anonymous about 19 years ago
Legacy ID: #3365697 Legacy Poster: Michael Kay (mhkay)
I don't think it's possible to achieve this without some very complex system programming: the base URI is saved only by expressions that know they need it, because it would be too expensive to save it with every XPath expression in the stylesheet. I'd suggest you design your function so the user puts in a call of base-uri() as a second argument. Michael Kay
Please register to reply