Skip to content

369: add fixed-prefixes attribute in XSLT - #470

Merged
ndw merged 9 commits into
qt4cg:masterfrom
michaelhkay:Issue369-namespaces-for-functions
Nov 29, 2023
Merged

369: add fixed-prefixes attribute in XSLT#470
ndw merged 9 commits into
qt4cg:masterfrom
michaelhkay:Issue369-namespaces-for-functions

Conversation

@michaelhkay

Copy link
Copy Markdown
Contributor

A solution to some of the problems identified in issue #369. This proposal affects XSLT only.

@ndw

ndw commented May 4, 2023

Copy link
Copy Markdown
Contributor

I'm not a fan, really, but I won't stand in the way.

Do I understand correctly that if I say fixed-prefixes="local" in an imported stylesheet, the binding varies depending on who imports it? What happens if it has its own xmlns:local declaration? What happens if it's used as a top-level stylesheet?

@michaelhkay

Copy link
Copy Markdown
Contributor Author

Do I understand correctly that if I say fixed-prefixes="local" in an imported stylesheet, the binding varies depending on who imports it? What happens if it has its own xmlns:local declaration? What happens if it's used as a top-level stylesheet?

If it has its own xmlns:local="xxxx", that takes precedence. Otherwise, yes, it depends on who imports it. Which is a little bit scary (though not unlike chameleon schema documents in XSD). But I think it's viable, and it certainly makes it a lot easier to maintain consistent namespace declarations across a large multi-module stylesheet. I found this was a lot easier to specify than the idea of importing namespace definitions from some common shared place, and I think it's easier to use because you just declare the namespaces in your top level module and let them cascade down.

It's not an intended feature that you can load the same module and bind it to different namespaces on different occasions, but I guess people might find some smart ways to exploit that. Which might or might not be desirable.

If the module is used at the top level, you'll get a static error saying "local" is undefined.

@michaelhkay

Copy link
Copy Markdown
Contributor Author

I have submitted a substantial revision of the proposal to take comments into account (particularly from @dnovatchev). Namespaces are no longer automatically inherited from including/importing modules, though this can be achieved if required by using shadow attributes and static variables. Namespaces may now be adopted from an external XML document, which can be any document at all, including but not confined to a stylesheet module or a specimen source document.

@ChristianGruen ChristianGruen added the Revise PR has been discussed and substantive changes requested label Jul 22, 2023
@ChristianGruen ChristianGruen added Blocked PR is blocked (has merge conflicts, doesn't format, etc.) and removed Revise PR has been discussed and substantive changes requested labels Aug 29, 2023
@michaelhkay
michaelhkay force-pushed the Issue369-namespaces-for-functions branch from 6b5bace to 6abd82e Compare September 27, 2023 17:58
@michaelhkay michaelhkay added Tests Needed Tests need to be written or merged and removed Blocked PR is blocked (has merge conflicts, doesn't format, etc.) labels Sep 28, 2023
@ChristianGruen ChristianGruen changed the title 369 add fixed-prefixes attribute in XSLT 369: add fixed-prefixes attribute in XSLT Oct 18, 2023
@ndw ndw added the XSLT An issue related to XSLT label Oct 23, 2023
Comment thread specifications/xslt-40/src/xslt.xml Outdated
<p>For example, a namespace declaration of the form
<code>xmlns:math="http://www.w3.org/2005/xpath-functions/math</code> establishes a binding
of the prefix <code>math</code> to the namespace URI <code>http://www.w3.org/2005/xpath-functions/math</code>,
thereby enabling functions in that namespaces to be invoked using an expression such as

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespaces - - > namespace

Comment thread specifications/xslt-40/src/xslt.xml Outdated
<error spec="XT" type="static" class="SE" code="0122">
<p>It is a <termref def="dt-static-error">static error</termref> if a token
appearing in the <code>fixed-namespaces</code> attribute takes a form
that is not one of the permitted forms, or if it interpreted as a URI

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it - - > if it is

@michaelhkay
michaelhkay force-pushed the Issue369-namespaces-for-functions branch from 6abd82e to 01452ae Compare November 28, 2023 22:22
@ndw

ndw commented Nov 29, 2023

Copy link
Copy Markdown
Contributor

The CG agreed to merge this PR at meeting 056.

@ndw
ndw merged commit 544383a into qt4cg:master Nov 29, 2023
@deblock deblock added Tests Added Tests have been added to the test suites In Saxon 13 The feature is implemented in the Saxon 13 development branch and removed Tests Needed Tests need to be written or merged labels Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In Saxon 13 The feature is implemented in the Saxon 13 development branch Tests Added Tests have been added to the test suites XSLT An issue related to XSLT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants