Page 1 of 1

Smart edit in xstl stylesheets based on schema components

Posted: Sat Oct 04, 2014 11:14 am
by fsteimke
Hi,

on of the great features of Oxygen is smart edit within xslt scripts based on the structure of document instances.

Lets say i have a document instance with root element a and childs b and c. Then, for a template that matches /a, the xslt editor will suggest childs b and c in apply-template rules, for example.
This will happen if i have defined a scenarion for the stylesheet which references the document instance as input.
I understand, that the knowledge "b and c are legal childs of a" has been learned from the structure of the document instance of the scenario.

I would expect that the same would happen when my script imports a schema and has template rules defined for schema components. For the example given above, this would be

Code: Select all


<xsl:import-schema schema-location="schema.xsd"/>
<xsl:template match="schema-element(a)">
<xsl:value-of select="b"></xsl:value-of>
</xsl:template>
Observations:
  • there is no smart edit when i match schema-element(a), although the scenario has not changed. Neither b nor c whill show up as suggestions in the value-of expression. Its kind of a regression compared to the non-schema-aware version.
  • when i switch back to match='a' again, smart edit behaves like before. This is the case even if the schema defines an optional child d for root element a. Since this is not in the document instance, this optional element d does not show up as a suggestion in the template rule for a.
To conclude: my feature request is smart edit within xslt template rules not only based on a sctructure which has been learned from document instances, but also for schema-components, that is:
  • match='schema-element(E)'
  • match='element(*, T)'
The way that oxygen behaves today prevents users from developing schema-aware scripts.

Sincerly,
Frank

Re: Smart edit in xstl stylesheets based on schema component

Posted: Tue Dec 23, 2014 1:19 pm
by radu_pisoi
Hi Frank,

Thank you for your suggestions and sorry for the delay.

The content completion driven by the XML Schema when proposing input elements in an XSLT script is indeed a feature that currently is missing in oXygen.

Also, the schema-aware editing support is not available. The schema-element(), element() items are not proposed by the content completion and they aren't taken into account when compute the content completion context.

As you already suggested, the XML Schema(s) used by the content completion can be inferred from the stylesheet's imported schemas. However, this approach is not always correct because there are cases when schemas were imported in the stylesheet to validate the output document.

So, we need an additional mechanism for specifying the XML Schema to be used by the content completion. Maybe a good place would be the XSLT Input view which right now is computing its input only from the structure of the document. Also, its model is used by the content completion when computing the input elements.

This feature is already registered in our issue tracking system. I will add you vote for implementing it, therefore you will be notified when it will be fixed.

Re: Smart edit in xstl stylesheets based on schema component

Posted: Tue Feb 10, 2015 9:26 am
by Patrik
Hi Radu,

after getting deeper into schema aware xslt I was missing the same feature. So please add my vote for it.

Just to be sure: The content-completion should work as well for variables:
<xsl:variable select="..." as="element(*, MyType)"/>

And the "go to definition" command should work as well for the argument of schema-element(elementName) and the second argument of element(*, typeName).

Regards,

Patrik

Re: Smart edit in xstl stylesheets based on schema component

Posted: Tue Feb 10, 2015 11:22 am
by adrian
Hi Patrik,

I added your vote and your comments to the request on our issue tracking tool.

Regards,
Adrian