Smart edit in xstl stylesheets based on schema components

Are you missing a feature? Request its implementation here.
fsteimke
Posts: 80
Joined: Tue Jan 01, 2013 3:19 pm

Smart edit in xstl stylesheets based on schema components

Post 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
radu_pisoi
Posts: 403
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

Re: Smart edit in xstl stylesheets based on schema component

Post 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.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Smart edit in xstl stylesheets based on schema component

Post 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
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Smart edit in xstl stylesheets based on schema component

Post by adrian »

Hi Patrik,

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

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply