[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: In XSLT context, base-uri() and document-uri() ret

Subject: Re: In XSLT context, base-uri() and document-uri() return different values
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Aug 2021 16:56:35 -0000
Re:  In XSLT context
The document from which the element Ibm applying base-uri() to is
constructed thusly:



  <xsl:variable name="input.map" as="document-node()?">
    <xsl:apply-templates select="document($input.map.url)"
mode="normalize-map"/>
  </xsl:variable>



And then the variable with the element is constructed like so:



  <xsl:variable name="current-topicrefs"
select="$input.map//*[contains(@class, ' map/topicref
')][dita-ot:get-path($PATH2PROJ, .) = $current-file]" as="element()*"/>
  <xsl:variable name="current-topicref" select="$current-topicrefs[1]"
as="element()?"/>



Given that document-uri(root($current-topicref)) returns the correct (or at
least expected) answer, it suggests that something is off with base-uri().



Cheers,



E.



--

Eliot Kimber

http://contrext.com







From: "Michael Kay mike@xxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Reply-To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wednesday, August 18, 2021 at 10:52 AM
To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  In XSLT context, base-uri() and document-uri() return
different values



We've had to make changes to document-uri() because we were setting it in
cases where we couldn't guarantee that two different documents never have the
same document-uri(), which is an implicit requirement of the spec. For example
copy-of should retain the base URI but drop the document URI.



I'm not aware of any corresponding changes to base URI, but it could be
collateral damage. Neither concept maps particularly well to the Java concept
of System ID.



How is this document being created?



Michael Kay

Saxonica



On 18 Aug 2021, at 16:27, Eliot Kimber ekimber@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:



In the context of an XSLT 3 transform run by Saxon-HE 9.9.1.7J, I have a
variable that contains an element from a document loaded using the document()
function.



In my code I use base-uri() to get the base URI of the element in order to
then resolve URIs relative to this element. This is in code thatbs been
around a long time (nearly 10 years).



In my latest use of this code, Ibm seeing that base-uri() for the node
reflects the URI of the transform, not the node, but document-uri() for the
elementbs root returns the expected document URI:



     [xslt] + [DEBUG] df:resolveTopicRef():
base-uri($context)="file:/Users/eliot.kimber/git/dita-ot/dita-ot-air/plugins/
org.dita.html5/xsl/map2html5Impl.xsl"

     [xslt] + [DEBUG] df:resolveTopicRef():
document-uri($context)="file:/Users/eliot.kimber/git/temp/aair/air-html/bundl
e-aair-automated-incident-response.ditamap"



My understanding of base-uri() is that I should get the same values for
base-uri() and document-uri() in this case because there are no explicit
xml:base attributes in the source document.



Why am I seeing this anomalous result from base-uri()? I didnbt see anything
in the XSLT 3 spec or in the XPath spec that would suggest this behavior
(looking for mentions of bbase-urib).



Thanks,



Eliot





--

Eliot Kimber

http://contrext.com





XSL-List info and archive

EasyUnsubscribe (by email)



XSL-List info and archive

EasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.