${ask} editor variable return an error
Having trouble installing Oxygen? Got a bug to report? Post it all here.
${ask} editor variable return an error
Hi,
I'm using a custom action in CSS, that use the editor variable ${ask}. We use this editor variable to ask for an URL that will be used as an xslt parameter.
This URL "https://www.youtube.com/?gl=FR&hl=fr" return an error
I'm using oXygen Desktop 25.1 and a custom DITA framework.
Thanks for your help!
I'm using a custom action in CSS, that use the editor variable ${ask}. We use this editor variable to ask for an URL that will be used as an xslt parameter.
Code: Select all
{
content:
oxy_button(action, oxy_action(
name, '[+Button]',
description, 'description',
operation, 'ro.sync.ecss.extensions.commons.operations.XSLTOperation',
arg-script, 'actions/custom.xslt',
arg-action, 'Replace',
arg-externalParams, "g-url=${ask('Enter an URL : ', url)}"
),
transparent, true,
actionContext, element,
showIcon, true);
color: blue;
font-weight: bold;
}
Code: Select all
Chunk [g-url="https://www.youtube.com/?gl=FR&hl=fr"] is not a valid entry.
Thanks for your help!
Re: ${ask} editor variable return an error
Hi,
This "Chunk ... is not a valid entry." does not seem to be an error Oxygen would throw from what I looked in our code.
So your CSS button invokes an XSLT operation with a parameter named "externalParams":
https://www.oxygenxml.com/doc/versions/ ... l1_dgk_54b
In the value of "externalParams" you are expanding an ask editor variable which will show a dialog to the end user and the end user will probably paste an URL there.
Did you define an xsl:param with name "g-url" in your stylesheet in order to get there the value of the URL? Do you receive the proper value in the stylesheet? What do you do further with that value?
Can you show me a screenshot with the entire Oxygen screen at the time the error is reported to you?
Regards,
Radu
This "Chunk ... is not a valid entry." does not seem to be an error Oxygen would throw from what I looked in our code.
So your CSS button invokes an XSLT operation with a parameter named "externalParams":
https://www.oxygenxml.com/doc/versions/ ... l1_dgk_54b
In the value of "externalParams" you are expanding an ask editor variable which will show a dialog to the end user and the end user will probably paste an URL there.
Did you define an xsl:param with name "g-url" in your stylesheet in order to get there the value of the URL? Do you receive the proper value in the stylesheet? What do you do further with that value?
Can you show me a screenshot with the entire Oxygen screen at the time the error is reported to you?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: ${ask} editor variable return an error
Hi,
@Stefan : I already tried URL escaping. '&' is correctly converted to &, it's '=' that cause trouble.
@Radu
What I tried :
EDIT : I created a new framework, disabling all my custom framework and the problem is still here. "=" should be the issue ...
@Stefan : I already tried URL escaping. '&' is correctly converted to &, it's '=' that cause trouble.
@Radu
Yes, exactlyIn the value of "externalParams" you are expanding an ask editor variable which will show a dialog to the end user and the end user will probably paste an URL there.
Our XSLT looks like this.Did you define an xsl:param with name "g-url" in your stylesheet in order to get there the value of the URL? Do you receive the proper value in the stylesheet? What do you do further with that value?
Code: Select all
<?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" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="saxon xs xd" version="2.0">
<!-- This is an XPath location to be sent by the operation to the script -->
<xsl:param name="currentElementLocation"/>
<!-- url fournie en paramètre -->
<xsl:param name="g-url" as="xs:anyURI?"/>
<xsl:variable name="position" select="saxon:eval(saxon:expression($currentElementLocation))"
as="element()"/>
<xd:doc>
<xd:desc>
<xd:p></xd:p>
</xd:desc>
</xd:doc>
<xsl:template match="/*">
<xsl:copy>
<xsl:attribute name="href" select="$g-url"/>
<xsl:attribute name="format" select="'html'"/>
<xsl:attribute name="scope" select="'external'"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
- changing XSLT version 2.0 to 3.0
- changing "g-url" parameter type to "xs:string", to nothing
- in CSS action, changing "url" to "generic"
- having paramter "g-url" but not using it
- before.png (644.97 KiB) Viewed 1034 times
- after.png (674.37 KiB) Viewed 1034 times
- Attachments
-
- Capture d’écran 2024-02-23 à 10.28.19.png (674.37 KiB) Viewed 1034 times
Re: ${ask} editor variable return an error
Hi,
I managed to setup and reproduce the problem on my side, the "arg-externalParams" parameter takes a comma separated list of "paramName=paramValue" so once the value starts like in your case having "=" inside it, the parameters parser breaks.
I added an internal issue based on this problem, pasting the issue ID below for future reference:
EXM-54248 Cannot specify parameter value containing "=" for xslt operation
But I'm not sure about how to approach this, maybe allow wrapping the values in some sort of quotes if they contain equal signs inside them...
A hack in such a case may be to show the URL input dialog directly from the XSLT stylesheet:
and remove the parameter from the CSS side:
Btw, recent versions of the Saxon processor no longer support saxon:eval, you would need to use the xsl:evaluate element and raise the XSLT version to 3.0.
By the way, what are you attempting to do? When someone pastes an URL over a selection, attempt to wrap it in a DITA <xref> link to that URL?
Regards,
Radu
I managed to setup and reproduce the problem on my side, the "arg-externalParams" parameter takes a comma separated list of "paramName=paramValue" so once the value starts like in your case having "=" inside it, the parameters parser breaks.
I added an internal issue based on this problem, pasting the issue ID below for future reference:
EXM-54248 Cannot specify parameter value containing "=" for xslt operation
But I'm not sure about how to approach this, maybe allow wrapping the values in some sort of quotes if they contain equal signs inside them...
A hack in such a case may be to show the URL input dialog directly from the XSLT stylesheet:
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:saxon="http://saxon.sf.net/"
exclude-result-prefixes="saxon xs xd" version="2.0"
xmlns:optionpane="java:javax.swing.JOptionPane">
<!-- This is an XPath location to be sent by the operation to the script -->
<xsl:param name="currentElementLocation"/>
<!-- url fournie en paramètre -->
<xsl:param name="g-url" select="optionpane:showInputDialog(null, 'ENTER URL')"/>
Code: Select all
content:
oxy_button(action, oxy_action(
name, '[+Button]',
description, 'description',
operation, 'ro.sync.ecss.extensions.commons.operations.XSLTOperation',
arg-script, 'actions/custom.xslt',
arg-action, 'Replace'
),
transparent, true,
actionContext, element,
showIcon, true);
color: blue;
font-weight: bold;
By the way, what are you attempting to do? When someone pastes an URL over a selection, attempt to wrap it in a DITA <xref> link to that URL?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: ${ask} editor variable return an error
Hi Radu,
thanks for your explanation. It was strange because we use this action since at least 2 years with no problem. We recently upgrade oXygen to 25.1, maybe something changed.
I will try your hack, or find an other method.
thanks for your explanation. It was strange because we use this action since at least 2 years with no problem. We recently upgrade oXygen to 25.1, maybe something changed.
I will try your hack, or find an other method.
thanks, we are migrating this framework to webauthor and newer version of oxygen so I will definitively to this.Btw, recent versions of the Saxon processor no longer support saxon:eval, you would need to use the xsl:evaluate element and raise the XSLT version to 3.0.
An user can input a specialized xref without attribute such as <lire/>. We use this action to add an @href attribute on this element by asking user the desire URL.By the way, what are you attempting to do? When someone pastes an URL over a selection, attempt to wrap it in a DITA <xref> link to that URL?
Re: ${ask} editor variable return an error
Hi Arthur,
As far as I know from when we originally wrote the XSLTOperation it splits the parameters by "=". But it's possible that as the problem occurs in certain cases when the URL contains "=", maybe nobody else on your team pasted before such an URL in the ask dialog until now.
Regards,
Radu
As far as I know from when we originally wrote the XSLTOperation it splits the parameters by "=". But it's possible that as the problem occurs in certain cases when the URL contains "=", maybe nobody else on your team pasted before such an URL in the ask dialog until now.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service