Difference between revisions of "Eg-43-xmlns-not-accessible"

From Provenance WG Wiki
Jump to: navigation, search
(Identify the problem)
(Identify the problem)
Line 4: Line 4:
== Identify the problem ==
== Identify the problem ==
Should appear in http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201212/maillist.html

Latest revision as of 15:17, 14 December 2012

All PROV examples

  • author:

Identify the problem

Should appear in http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201212/maillist.html

Hello, xsl,

I'm working on an implementation for W3C's PROV recommendation [1], and I ran into a roadblock that I hope this list can help me with.

If I have the following input document (shortened from [2], available at [3]):


    <prov:entity prov:ref="ex:The-Painter"/>
    <prov:activity prov:ref="ex:crash"/>
    <ex:circumstances>plane accident</ex:circumstances>


I'm trying to access the value "http://example.com/ns/ex#" given the value "ex", without the transform knowing a priori.
To illustrate what I need, I have the following XSL, which needs a new @select on the variable named "magic".

<xsl:output method="text"/>

<xsl:key name="prefix" match="//prov:prefix" use="@prov:id"/>

<xsl:template match="/">

   <xsl:variable name="prefix" select="substring-before(//prov:entity/@prov:ref,':')"/>

   <xsl:variable name="magic" select="concat('magic(',$prefix,')=http://example.com/ns/ex#')"/>

   <!-- Cannot access /prov:document/@xmlns:ex using a variable-constructed XPath.
    xsl:variable name="magic1" select="concat(prov:document/xmlns:',$prefix,')"/

   <!-- These two work, but require an addition of a <prov:prefix> element -->
   <xsl:variable name="magic2" select="//prov:prefix[@prov:id=$prefix]"/>
   <xsl:variable name="magic3" select="key('prefix',$prefix)"/>

   <xsl:value-of select="concat('The full URI of your painting is ',


Some homework that I've done hasn't led me to a solution:

suggests that one can't _write_ an @xmlns.
Which leads me to believe that one can't _read_ one, either.
I think the problem is that I don't ever have an element in the "ex" namespace...

might cover my issue by saying it's "never available", but could someone confirm that?
I think this is the case.

seems to confirm that I can't construct the xpath to access the /prov:document's attribute from a variable
<xsl:value-of select="concat(prov:document/xmlns:',$prefix,')"/>

Given this, I'm inclined to suggest to the PROV-WG that they include something like:
  <prov:prefix prov:id="ex">http://example.com/ns/ex#</prov:prefix>

Thanks for your time and consideration. Am I missing any other alternative?

Tim Lebo

[1] http://www.w3.org/TR/prov-overview/
[2] http://www.w3.org/TR/prov-xml/#term-Invalidation
[3] http://dvcs.w3.org/hg/prov/file/tip/examples/eg-43-xmlns-not-accessible/xml

The use of provenance

The PROV example

How PROV is accessed and queried?