Unparsed entity
Added by Anonymous over 19 years ago
Legacy ID: #3181716 Legacy Poster: vguiraud (vguiraud)
Hello, Is there some way in XPath/XQuery language of getting the URI of an unparsed entity [equivalent to unparsed-entity-uri() function in a XSLT context]. Thank you for your help. Virginie.
Replies (1)
RE: Unparsed entity - Added by Anonymous over 19 years ago
Legacy ID: #3181939 Legacy Poster: Michael Kay (mhkay)
Unfortunately, this function is XSLT-only. I've no idea why, other than the fact that the kind of people who might use unparsed entities are better represented on the XSL WG than on XQuery. You can almost get the functionality by calling the relevant internal method as an extension function, thus: declare namespace doc = "java:net.sf.saxon.om.DocumentInfo"; doc:getUnparsedEntity(doc('test.xml'), 'hatch-pic') This returns a sequence containing first the entity's systm ID and then its public ID. However this fails saying "object is null" if there is no public ID. To tackle this case you'll have to write your own extension function: static externalUnparsedEntityId(DocumentInfo doc, String name) { return doc.getExternalEntity(name)[0]; } Michael Kay
Please register to reply