Re: [xsl] Are there things missing in XSLT which force people to use, say, Java to process XML?

Subject: Re: [xsl] Are there things missing in XSLT which force people to use, say, Java to process XML?
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Fri, 29 Oct 2010 15:05:15 +0200
Roger,

I was just thinking that the current XSLT standard lacks interactivity, and was about to suggest an element xsl:prompt for further revisions of the standard.

Scenario: A stylesheet that converts a .docx (or OpenOffice, or IDML, ...) file to XHTML and discovers ordinary paragraphs that look like headings: all large font and boldface. A person should be able to interactively correct the markup. The stylesheet should be able to prompt this person:

<xsl:template match="para[my:looks-like-heading(.)]" mode="correct-structure">
<xsl:prompt bind-variable="user-choice" as="xs:string">
Found heading candidate: <xsl:value-of select="." />
I suggest that I convert it to a heading. What should I do? [k]eep as is, make it h[1], h[2], h[3], h[4], h[5], h[6], put it in custom markup (specify as 'element@attribute=value', e.g., p@class=check-later)
</xsl:prompt>
<xsl:choose>
<xsl:when test="$user-choice eq 'k'>
<xsl:copy-of select="." />
<xsl/when>
<xsl:when test="matches($user-choice, '[1-6]')">
<xsl:element name="h{$user-choice}">
<xsl:apply-template mode="#current" />
</xsl:element>
</xsl:when>
<xsl:when test="matches($user-choice, '^([-_:\w]+)(@([-_:\w])=(.*))?$')">
<xsl:analyze-string ....>
...
/
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="." />
<xsl/otherwise>
</xsl:choose>
</xsl:template>


I think you can somehow make XSLT interactive in a Java application that invokes an XSLT processor. For example, oXygen is a Java application that acts as an XSLT debugger, allowing breakpoints, among other things. If you can manipulate variables at a breakpoint (not sure whether oXygen permits this), then you have a facility such as xsl:prompt in a combined Java/XSLT application.

The lack of xsl:prompt did'nt make me develop custom Java applications around my XSLT, but from time to time I wish there were such interactive facilities in pure XSLT.

-Gerrit


On 29.10.2010 14:28, Costello, Roger L. wrote:
Hi Folks,

Many developers use Java to process XML documents.

Why?

Are there things missing in XSLT which force them to use Java? What things?


/Roger



-- Gerrit Imsieke Geschdftsf|hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vvckler

Current Thread