• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 786
  • Last Modified:

XLink, XPointer, XInclude, and Saxon

I have a rough understanding as to what XLink is (in terms of @type='simple' at least).

What is XPointer and XInclude? I keep seeing their names pop up?

Are these compatible with SaxonB?
0
numberkruncher
Asked:
numberkruncher
  • 5
  • 3
1 Solution
 
ChristoferDutzCommented:
XLink is used to define links between indivudual xml documents. You can think of them as cooler a-tags you know from HTML. You can define unidirectional and bidirectional relations between data. I guess Saxon has nothing to do with that.

Xinclude is used to assemble Xmldocuments by "importing" other (not necesarily xml) documents. Here an example from Wikipedia:
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude">
   <head>...</head>
   <body>
      ...
      <p><xi:include href="license.txt" parse="text"/></p>
   </body>
</html>

XPointer is an alternative to XPath in adressing and referencing nodes in a Xml Document. It can be thought of something similar to XPath.

I doubt that Saxon implements the XPointer stuff and I have read that is supports XInclude partially.
0
 
numberkruncherAuthor Commented:
I think that I understand XInclude now...it is a process which occurs prior to an XSLT transform to include externally referenced content.

Here is where I am getting confused. From information that I have found on several websites:

XPointer:
  > Uses XPath to locate content within a document.
  > Can be used as the fragment part of a URI. I am not sure how this part gets resolved/processed by an XSLT 2.0 transform?

XLink:
  > Apparently XPointer can be used within the "xlink:href" attribute.

XInclude:
  > Apparently XPointer is used within one of the attributes of XInclude to locate XML content.


I have tried using the XPath expression "document('myFile.xml#id1')" with the SaxonB processor, and it does appear to locate the correct XML content. Is this standard of all XSLT 2.0 processors? Are there more XPointer functions that can be used by the "document" function of XSLT 2.0 processors? Am I going about this in the wrong way?
0
 
ChristoferDutzCommented:
Ok as far as I have googled, XPointer extends XPath with some features that can be used for expressions, that were not expressable in ordinary XPath. I think this is therefore not addressed by the Xsl-transofmer, but the parser used for the xsl-transformation.

Seems like the parser used by Saxon, as it also supports Xpath2.0, seems to support at least a subset of XPointer.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
numberkruncherAuthor Commented:
Do you know of a complete XSLT implementation (preferably 2.0, and Saxon compatible) of XPointer?

Whilst ideally I would like to have support of the W3C recommended XPointer schemes, I would rather like "xmlns()", "element()", and the non-W3C "xpath1()" scheme support.
0
 
ChristoferDutzCommented:
Well As I am only aware of Saxon as fully Xslt2.0 comatible Implementation.

An Eifel implementation of a rudimentry XSLT2.0 Processor: http://sourceforge.net/projects/gestalt/

A tool from Altova: http://www.altova.com/altovaxml.html

Microsoft seems to have started to work on one back in 2006, but I have never heard of a finished implementation.

I'd suggest sticking to Saxon.
0
 
ChristoferDutzCommented:
Argh, just saw that I totally misread your post ... here is a list (don't know how fresh it is and how complete):
http://www.w3.org/XML/2002/10/LinkingImplementations.html
http://www.cs.unibo.it/~fabio/XPointer/

But I have to admit, that all I could find was a lot of posts about mobody being able to find a xomplete XPointer implementation for Java.
0
 
numberkruncherAuthor Commented:
I have had a read through the links above, but I was unable to find an XSLT implementation.

I have started to write my own implementation for this, but am having major difficulties with one part. If I can work around this difficulty I think that I can come up with an implementation which supports "xpath1()", "xmlns()", and "element()".....but probably not the "xpointer()" scheme.

The problem that I am having is with "xmlns()".

For example, the URL:

http://example.com/something.xml#xmlns(abc=http://www.example.com) xpath1(//abc:test)

My implementation of the "xpath1" scheme is working, but it refuses to recognize the "abc" prefix.

I have tried constructing a temporary node set in XSLT which includes all of the specified namespaces, and this much works, BUT I cannot find a way of getting the "document()" XPath function to recognize these namespaces.

Is there a workaround to this problem? Essentially I need to dynamically register prefixes in the context of the external document to fix this problem.......or alternatively find a complete implementation of XPointer/XInclude written in XSLT.

<xsl:variable name="temp-context">
   <!-- constructs an element with all of the 'xmlns()' added -->
</xsl:variable>
 
<!-- Move into $temp-context so that namespaces are in the current context -->
<xsl:for-each select="$temp-context">
   <xsl:sequence select="document($locator-path)/saxon:evaluate($xpath-expr)"/>
</xsl:for-each>

Open in new window

0
 
ChristoferDutzCommented:
Maybe you should close this topic and open a new one, as this seems to deal with an entirely diffrernt problem. I think the original Question is solved but with your current question, I can no longer support you :-(

I doubt that any expert will look into such an old discussion, so I'd suggest to close this one and ask your new Question.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now