-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify rule for attribute values on Extension Instructions used to invoke named templates #92
Comments
It seems to me that this is already mandated:
However, one of the examples above contradicts this, as nested quotes are not used in the extension instruction:
And indeed seems to me to contradict the other example, where a lack of double quotes suggests to me that the attributes should be interpreted as XPath:
I think at least one correction to the spec is needed for consistency: I think my preferred correction agrees with Phil's suggestion: <log:message message="'Good morning'"/> |
@yamahito I agree that in the proposed specification there is indeed contradiction in the documentation and in the examples. However, in the Saxon documentation though there is no such contradiction. The Saxon 11.2 behaviour is consistent with the examples. As an XSLT developer I pass variable/parameter values much more frequently than string-literals. Hence my preference to use:
Instead of:
For the rare occasions where I can hard-code a string-literal the extra nested quotes would (in my view) not be too burdensome:
As a hack I guess I could always declare the parameter as <xsl:template name="log:message">
<xsl:param name="message" as="xs:string+"/>
...
</xsl:template> I will delay making a decision on how I support the type-dependant aspect of this XSLT 4.0 feature in VS Code until there's been more discussion on this. So for now, extension instructions will have their attributes recognised as AVT's regardless of parameter type. The following screenshot of XSLT than runs with Saxon11 shows the problem this causes in the editor:
|
The purpose of the rules as written is to make these extension instructions behave as far as possible in the same way as typical built-in instructions. Most boolean parameters to existing instructions expect literal yes/no values, for example String-valued parameters to existing instructions generally expect either literal values (for example I think your arguments (1) and (2) apply equally well to the conventions followed for existing XSLT instructions, and I think it's more important to be consistent with these conventions than to improve on them. As for argument (3), I have learned over the years that designing a specification for the benefit of implementors rather than users is rarely a good idea. Syntax-directed editors do have a problem with XSLT modules containing references to other modules that might not be directly imported or included; I don't feel we are making that problem any worse. |
I concede the point on why using literal values for extension instructions is preferred. Even though I made argument 3 from the perspective of an implementor of a code editor (extension), it was with the interest of the XSLT developer in mind. I am first and foremost an XSLT developer (that's what I get paid for) - the editor is just a means to an end for me. I know this is outside the scope of the language designers but I'm hopeful there will be ways for the XSLT code editor to assist the XSLT developers (like myself) so they have some hint for each extension instruction attribute about whether a literal-value or XPath expression is expected before they edit it. I haven't tested this yet, but I'm assuming that an extension instruction attribute will be treated as a string-literal regardless of whether the type of the corresponding |
Regarding the rule in the current proposal for Invoking Named Templates with Extension Instructions:
I have some problems with this dependency on parameter type (to control whether value is an AVT or XPath expression):
xs:string
orxs:boolean
type passed as a param will be a variable reference so a coder needs to entername="{$myName}"
instead ofname="$myName"
in their XSLT editor.xs:string
type, the syntax:name="first"
would be easy for a human reader to misinterpret as aNameTest
instead of aStringLiteral
.The third point above is most important from my viewpoint as maintainer of an XSLT editor, but I believe the first two points are also valid.
For these reasons, I propose that: all attribute-values on extension instructions used to invoke named templates are treated as XPath expressions.
The text was updated successfully, but these errors were encountered: