Project

Profile

Help

unparsed-text-available unexpected behaviour

Added by Anonymous over 18 years ago

Legacy ID: #3772414 Legacy Poster: drwg (drwg)

I am using both the doc-available() and unparsed-text-available() xpath functions to load external xml and text documents relative to the source xml document respectively. I have implemented my own URIReslver which allows me to do this for the doc-available() function, but am not getting the expected/similar behaviour when using the unparsed-text-available() function. Although the custom URIReslover is called, the value of the href parameter in the resolve(String href, String base) is that of the stylesheet file and not the external file I am attempting to load, this is in contrast to the behaviour when the doc-avilable() function is called. Thus it appears I am not able to load a text document relative to the source document even using a URIResolver. Is this the correct behaviour?


Replies (4)

Please register to reply

RE: unparsed-text-available unexpected behavi - Added by Anonymous over 18 years ago

Legacy ID: #3773923 Legacy Poster: Michael Kay (mhkay)

Apologies for the delay in responding. For some reason SourceForge has stopped sending me notifications of forum posts. The URIResolver is not called for the URI specified to unparsed-text() or unparsed-text-available(), so I can't account for the effect you are seeing. However, I can confirm that the specification for unparsed-text() says that the URI is resolved against the base URI of the stylesheet; if you want it resolved against the base URI of a source document, use the resolve-uri() and base-uri() functions to achieve this.

RE: unparsed-text-available unexpected behavi - Added by Anonymous over 18 years ago

Legacy ID: #3773970 Legacy Poster: drwg (drwg)

Sorry, unfortunately I cannot post actual code due to the nature of my company and no direct internet access, I should have mentioned in my previous post that I am using the resolve-uri() and base-uri() functions as follows; unparsed-text-available(resolve-uri($text_filename, base-uri(/))) when the resolve() method is called on the URIResolver the href parameter is the name of the stylesheet from which the function is called from and not the unparsed text document. However, when the following code is called from a different stylesheet to load an xml file everything works ok doc-available(resolve-uri($xml_filename, base-uri(/)))

RE: unparsed-text-available unexpected behavi - Added by Anonymous over 18 years ago

Legacy ID: #3774088 Legacy Poster: Michael Kay (mhkay)

As I said, as far as I'm aware the URIResolver is not called to process unparsed-text() or unparsed-text-available(). So I can't account for the behaviour you are describing.

RE: unparsed-text-available unexpected behaviour - Added by Anonymous over 18 years ago

Legacy ID: #3778892 Legacy Poster: drwg (drwg)

Thanks for the replies, I have managed to resolve the behavioural issues, but still have a problem when attempting to resolve a text document relative to the source xml document using the following function within the stylesheet as suggested in one of your previous posts; unparsed-text($txt_filename, base-uri(/)) The error I am getting is thus; XTDE1170: Cannot resolve relative URI: although as I mentioned in my previous post the equivalent loading of an xml document using the following works ok; document($xml_filename, base-uri(/)) it would appear that this is not possible, appologies for any lack of understanding. Thanks

    (1-4/4)

    Please register to reply