[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] scripting or scripting-like features
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|