Eclipse: Sync XSLT-Input and Attributes

Are you missing a feature? Request its implementation here.
amix
Posts: 81
Joined: Sat Aug 05, 2006 10:43 pm

Eclipse: Sync XSLT-Input and Attributes

Post by amix »

I like to use the XSLT-Input View in order to get an overview of the originating XML file I am writing a transformer for.

However, by times, it might be interesting to have a full view on the attributes and values of a node I inspect in the XSLT-Input view. The way to do it now is to change the editor to the XML source's and navigate in this.

This could be much easier (and quicker) if there'd be a way to get all the information of the source XML via an Attributes View, that is connected to the XSLT-Input. One could have two Attribute Views open, one for the editor in use, the other one locked to the XSLT-Input View. Thanks.
Andreas
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Eclipse: Sync XSLT-Input and Attributes

Post by sorin_ristache »

Hello,
amix wrote:it might be interesting to have a full view on the attributes and values of a node I inspect in the XSLT-Input view. The way to do it now is to change the editor to the XML source's and navigate in this.
Why do you have to switch to the XML editor ? The XSLT Input view displays the full structure of the XML source while editing the XSLT stylesheet: all possible element names with their location in the XML source represented as the path in the tree and all possible attributes of each element name.
amix wrote:This could be much easier (and quicker) if there'd be a way to get all the information of the source XML via an Attributes View that is connected to the XSLT-Input.
Doesn't the XSLT Input view contain all the information about the structure of the source XML ? Please can you give more details about what would you need to be added about the XML source of the transformation to what the XSLT Input already provides and how would you use that when editing an XSLT stylesheet ?
amix wrote:One could have two Attribute Views open, one for the editor in use, the other one locked to the XSLT-Input View. Thanks.
The contents of the second one would duplicate the attributes presented in the XSLT Input view.


Regards,
Sorin
amix
Posts: 81
Joined: Sat Aug 05, 2006 10:43 pm

Re: Eclipse: Sync XSLT-Input and Attributes

Post by amix »

sorin wrote:Hello,
amix wrote:it might be interesting to have a full view on the attributes and values of a node I inspect in the XSLT-Input view. The way to do it now is to change the editor to the XML source's and navigate in this.
Why do you have to switch to the XML editor ? [...] and all possible attributes of each element name.
Yes, the attribute and element names. But not their values. Sometimes I can not create a template, that fits all. Sometimes the way, I need to handle the XSLT is dependant on the value of the attribute. Have a look at this (this is from my work on transforming OpenDocument into XHTML+CSS)

Code: Select all


	<xsl:template match="style:style[@style:name='Text_20_body']">
<xsl:text>.</xsl:text><xsl:value-of select="@style:name"/> <xsl:text> { </xsl:text>
<xsl:if test="style:paragraph-properties">
<xsl:call-template name="css-processor"/>
</xsl:if>
<xsl:text>}</xsl:text>
</xsl:template>

<xsl:template match="style:style[@style:name='Quotations']">
<xsl:text>.</xsl:text><xsl:value-of select="@style:name"/> <xsl:text> { </xsl:text>
<xsl:if test="style:paragraph-properties">
<xsl:call-template name="css-processor"/>
</xsl:if>
<xsl:text>}</xsl:text>
</xsl:template>
Now, in this case it is pretty simple, since I could create a default template like this:

Code: Select all

<xsl:template match="style:style>
instead of

Code: Select all

<xsl:template match="style:style[@style:name='Quotations']">
But it is not that easy in reality. I need to take into account, that ODF is a very complex format, describing a document with its own stylesheet-template (the Document Tempate of the Word-Processor) with a lot of different details, shades and differentiations, that the user can change upon his own decision. Look at this:

Code: Select all

	
<xsl:template match="style:style[@style:name='Illustration']">
<xsl:text>span.</xsl:text><xsl:value-of select="@style:name"/> <xsl:text> { </xsl:text>
<xsl:if test="style:paragraph-properties">
<xsl:call-template name="css-processor"/>
</xsl:if>
<xsl:text>}</xsl:text>
</xsl:template>

<xsl:template match="style:style[@style:name='Emphasis']">
<xsl:text>span.</xsl:text><xsl:value-of select="@style:name"/> <xsl:text> { </xsl:text>
<xsl:if test="style:text-properties">
<xsl:call-template name="css-processor"/>
</xsl:if>
<xsl:text>}</xsl:text>
</xsl:template>
As you can see, there is two differences. While the first template is not distinguishable from the templates I show above - except for the value of style:name - the second one has a style:text-properties (instead of sytle:paragraph-properties), but still gets translated into a HTML <span> element.

A generic template-match for 'A' can be either a <p> or a <span> in the CSS, it really depends on the style:name="" attribute value. This is the point. And there is maybe 25-40 such templates, which I can reduce to a few by using intelligent pattern-matching, but I will never be able to create one template, that fits all. I need to fine tune it, since HTML+CSS is different from the ODF styles.
And this is the moment in which I switch forth and back between source and transformer.
sorin wrote:Doesn't the XSLT Input view contain all the information about the structure of the source XML ?
Yes, the structure is covered, but not the contents.
amix wrote:One could have two Attribute Views open, one for the editor in use, the other one locked to the XSLT-Input View. Thanks.
The contents of the second one would duplicate the attributes presented in the XSLT Input view.[/quote]

I meant views locked to editors. The views display contextually the current editor. If they could be locked (after they have been 'applied'), then I would be able to see the contents of the former while the other editor is active Though, I have found a solution, that solves my problems: It is possible to have both editors open at once, one on the top of screen, the other below it.

I must appologize. When I wrote all my feature-requests it was late-night/early morning and I was exhausted, not focussing enough. I should have realized that the XSLT-Input is a logical representation of all the element-names and attribut-names. It is just perfect the way it is and I would not want to see it changed.

However, I still could live with the possibility to have two Outline views present, with one being locked to a certain editor. This would mean, that it does not change the contents when the other editor gets activated, since that does have its own outline-view.

Please, post what you think. Maybe you even know of a solution to my problem, which is not so much of a problem anyway, but would more be a convenience/comfort feature. I still can align the two editors one above each other, it's just not that comfortable on small screens (I use a pretty high resolution, so I can live with that.)
Andreas
Post Reply