- From: Wendell Piez <wapiez@wendellpiez.com>
- Date: Fri, 27 Jun 2025 12:53:18 -0400
- To: Norm Tovey-Walsh <ndw@nwalsh.com>
- Cc: XProc Dev <xproc-dev@w3.org>
- Message-ID: <CAAO_-xyLjowcd+WQemOyTzoKO5ksPF-_-b-rWUCJ5FEaG3zoZQ@mail.gmail.com>
Norm, Thanks to you, George and Gerrit. And well done with the test findings: that's what tests are for, right? Has this issue been there all along (in XProc 1.0), or if not, what has changed? Grateful as always, Wendell On Fri, Jun 27, 2025 at 3:47 AM Norm Tovey-Walsh <ndw@nwalsh.com> wrote: > Earlier, I said that the proposed change in behavior had no effect on my > test suite results. That’s because I implemented it incorrectly. On further > attempts to implement it, about 30 tests fail. And some steps are > effectively no longer usable. > > Consider: > > <p:namespace-rename to="http://example.com/ns"/> > > That step changes the namespace name of elements in no namespace so that > they’re in the http://example.com/ns namespace. It’s the same as: > > <p:namespace-rename from="" to="http://example.com/ns"/> > > And “from” is declared as xs:anyURI. So with the proposed change, it > becomes, if not impossible, certainly wildly impractical, to pass the empty > string as an xs:anyURI value. > > I also tried to investigate the actual meaning of the xs:anyURI type. The > XML Schema definition of xs:anyURI has no facet for storing the base URI, > but explicitly says that the “value can be absolute or relative, and may > have an optional fragment identifier”. At the data type level, a relative > URI is free floating with no notion of its “inherent” base URI. > > And, just to be sure, I tested the behavior of XSLT (I mean, I *knew* what > the behavior was, but I wrote the test anyway because that’s safer.) > > If the behavior change proposed is extended beyond options to any > occurrence of an xs:anyURI (including, for example, in a p:variable), then > we’ll have behavior that is markedly different than XSLT: > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > exclude-result-prefixes="xs" > version="3.0"> > > <xsl:output method="xml" encoding="utf-8" indent="no"/> > > <xsl:variable name="file" > xml:base="http://example.com/path/" > select="xs:anyURI('file.xml')"/> > > <xsl:template name="xsl:initial-template"> > <xsl:call-template name="mytemplate"> > <xsl:with-param name="file" select="$file"/> > </xsl:call-template> > </xsl:template> > > <xsl:template name="mytemplate"> > <xsl:param name="file" as="xs:anyURI"/> > <doc> > <file><xsl:sequence select="$file"/></file> > <abs><xsl:sequence select="resolve-uri($file)"/></abs> > </doc> > </xsl:template> > > </xsl:stylesheet> > > That stylesheet produces <file>file.xml</file> and > <abs>file:/tmp/file.xml</abs> (because the stylesheet was in /tmp so > that’s the static-base-uri() of the stylesheet.) > > Having the same behavior as XSLT is in no way a technical requirement, but > it is reasonable to argue that it’s “what users will expect.” > > I’m coming around to the uncomfortable position that George is right about > what the spec says, but it doesn’t say what we meant. Certainly, the > p:namespace-rename case is strong evidence that resolving a relative URI > against a base URI was intended to be selective, not universal. > > Be seeing you, > norm > > -- > Norm Tovey-Walsh <ndw@nwalsh.com> > https://norm.tovey-walsh.com/ > > > The lasting pleasures of contact with the natural world are not reserved > for scientists but are available to anyone who will place himself under the > influence of the earth, sea and sky and their amazing life.--Rachel Carson > > -- ...Wendell Piez... ...wendell -at- nist -dot- gov... ...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org... ...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
Received on Friday, 27 June 2025 16:53:34 UTC