Solved

XLink, XPointer, XInclude, and Saxon

Posted on 2009-05-05
8
689 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
  • 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now