Solved

XLink, XPointer, XInclude, and Saxon

Posted on 2009-05-05
8
751 Views
Last Modified: 2013-11-18
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
Comment
Question by:numberkruncher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 24307418
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
 
LVL 13

Author Comment

by:numberkruncher
ID: 24308814
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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 24313619
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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 13

Author Comment

by:numberkruncher
ID: 24320945
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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 24323341
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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 24323360
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
 
LVL 13

Author Comment

by:numberkruncher
ID: 24323560
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
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
ID: 24325087
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question