[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

ShoXS: a Shorter XSL Syntax

Subject: ShoXS: a Shorter XSL Syntax
From: "Remco Bouckaert" <rrb@xxxxxxxx>
Date: Wed, 5 Jun 2002 07:27:34 +1200
shoxs
The last two year I have been doing quite a bit of
XSL scripting, but after a while I found the
syntax to be a bit too verbose to my taste. So, to 
help do the scripting I put together a little tool 
that translates XSL to a more compact syntax, edit
in that syntax and translate back to XSL. This syntax
is ShoXS (SHOrter Xsl Syntax, you get it:-).

ShoXS is a bit Javascript-ish, as far as XSL allows 
this. Just to give an impression, an XSL fragment 
from the XSL FAQ and its ShoXS equivalent:

===============================XSL=============================== 

<xsl:template name="displayyear">
    <xsl:param name="yearlist"/>
    <xsl:variable name="year" 
        select="substring-before($yearlist,',')"/>
    <xsl:choose>
        <xsl:when test="string-length($year) > 0">
            <td><xsl:value-of select="$year"/></td>
            <xsl:call-template name="displayyear">
                <xsl:with-param 
             name="yearlist"><xsl:value-of 
             select="substring-after($yearlist,',')"/>
               </xsl:with-param>
            </xsl:call-template>
       </xsl:when>
        <xsl:otherwise>
             <td><xsl:value-of select="$yearlist"/></td>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

===============================ShoXS============================== 
 
fun displayyear {
    par yearlist=""{}
    var year="substring-before($yearlist,',')"{}
    switch {
        case(string-length($year) > 0) {
            <td>val($year)</td>
            call displayyear {
                wpar yearlist=""{val(substring-after($yearlist,','))
               }
            }
        }
        default{
             <td>val($yearlist)</td>
        }
    }
}
 
=================================================================== 

If you want to see a bit more about ShoXS, have
a browse on http://www.xm.co.nz/ShoXS.htm where you
can find ShoXSPad, a notepad like tool to toggle between 
XSL and ShoXS. A bit more useful is a version integrated
in jEdit, which I use myself. 

It should be easy to get to grips with ShoXS if you know XSL: 
just key in the XSL, toggle to ShoXS and look at the ShoXS 
equivalent.

Let me know if you have any constructive comments or 
suggestions (or find any bugs).

Enjoy,

Remco
rrb@xxxxxxxx





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.