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

scripting or scripting-like features

Subject: scripting or scripting-like features
From: "Lawton, Scott" <slawton@xxxxxxxxxxxx>
Date: Tue, 10 Nov 1998 12:27:14 -0500
xsl if not equals
I've just spent more than a week using XSL to transform XML into HTML.  I
realize that XSL isn't ready for prime time but I thought it was better to
start with that than build something else from scratch.

I like the basic approach: specify a pattern to match tags and associate
with it an output template.  The XSL processor handles conflict resolution &
the inherent hierarchy of XML.  That's very useful.

However, it seems that the current draft of XSL just doesn't have enough
expressive power.  I've encountered so many things that would have been
trivial if I had clean, simple, orthogonal "scripting" power: variables,
arbitrary conditionals and general-purpose macros/functions/subroutines.
Some examples (not attempting XML/XSL syntax for the most part):

- create attributes; then later code doesn't have to distinguish between a
value provided in the XML file and a default value provided by XSL:

	if not attribute.exists(value)
		value = "50"
	<myTag value="{attribute(value)}"/>

- pass arbitrary flags to macros/functions/subroutines then test them:
	on doThis(someFlag)
		switch someFlag
			case "this"
				...
			case "that"
				...

- use character data in a conditional, e.g. given <someTag>the
value</someTag>
	<!-- add colon & space after the text, but not if there is no text!
-->
	if someTag not equals ""
		<xsl:process-children>
		<xsl:text>: </xsl:text>

- more flexibility in getting character data, e.g. the text until the first
tag, all text at the top level (at the moment I can only get the entire
text, including that nested in other tags)

- more direct access to data at any point in the tree, e.g. so a child
element can get an attribute from it's immediate parent -- or a parent could
make an arbitrary query of its children or descendents

I'm sure there are plenty more examples....

Scott


 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.