Skip to content

Conversation

@xml-project
Copy link
Member

I tried to spell out @gimsieke 's idea: Is it as easy as this?

@xml-project xml-project requested review from gimsieke and ndw February 28, 2025 14:53
@xml-project xml-project requested a review from a team as a code owner February 28, 2025 14:53
Copy link
Collaborator

@ndw ndw left a comment

Choose a reason for hiding this comment

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

I think that covers it.

@ndw
Copy link
Collaborator

ndw commented Feb 28, 2025

Except. Sigh. Doing things quickly always takes longer.

What is this supposed to produce?

<p:identity><p:with-input><doc/></p:with-input></p:identity>
<p:message select="."/>

If select is an ordinary option, that's the literal string ..

So then you think, I'll do this:

<p:identity><p:with-input><doc/></p:with-input></p:identity>
<p:message select="{.}"/>

That produces "" (the empty string, because AVTs are always the string value).

I think the expectation is more likely to be that select is a simple xs:string and it's treated as an expression that is evaluated to get the result.

@xml-project
Copy link
Member Author

@ndw I think the correct way to do it in this case is:
<p:identity><p:with-input><doc/></p:with-input></p:identity> <p:message> <p:with-option name="select" select="." /> </p:message>
You can't use an AVT in this case.
Does this make sense?

@ndw
Copy link
Collaborator

ndw commented Mar 1, 2025

Yes. I think you're right.

I was going to argue that the name select and the parallel with xsl:message would strongly encourage people to believe that it should just be an expression and we should do it that way. Then I remembered that the static context for a step doesn't include the in-scope variables.

If we make it an expression, you can type select="'test: ', .", but you can't type select="'test: ', $varname". The work around for . is just use p:with-option, the work around for variable names is really ugly expression like

select="'test: &quot;' || $varname || '&quot;'"

Where you have to make sure that the variables are resolved while the string is being constructed but the resulting string is still a valid expression. Yuck.

@xml-project
Copy link
Member Author

@ndw So your idea is to go back to select as xs:string and wait for better ideas to come up?

@ndw
Copy link
Collaborator

ndw commented Mar 1, 2025

No, I think item()* is fine, it means I can put more complicated things in the output if I use p:with-option. I'm just abandoning my thought that it should be an expression resolved by the step.

@xml-project
Copy link
Member Author

Oh, now I understand what you had in mind. Haven't thought of it this way. Is this why it reads:

If the test attribute is “true”, the select expression is evaluated and made available.

Should we change this?

@ndw
Copy link
Collaborator

ndw commented Mar 1, 2025

I don't know. The [p:]message attribute speaks of computing the value, but it has special rules about expand-text.

Does this seem like an improvement?

If the test attribute is “true”, the value of the select option is made available.

@xml-project xml-project requested a review from ndw March 1, 2025 08:07
Copy link
Contributor

@gimsieke gimsieke left a comment

Choose a reason for hiding this comment

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

the result of evaluating the select option is serialized and made available

@xml-project xml-project merged commit f3eafd2 into xproc:master Mar 1, 2025
2 checks passed
@xml-project xml-project deleted the fix-672 branch March 1, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants