Questioning XSL
Paul Prescod
paul at prescod.net
Fri May 21 19:45:48 BST 1999
Miles Sabin wrote:
>
> No, but do they have to be part of the *language*?
>
> Wouldn't a hypothetical DOM level X with direct support
> for XSL style queries not address most of these issues?
I asked for:
> XSL's optimized mix of "polymorphic dispatch", pattern
> matching and convenient template description.
You've given me only pattern matching. In JavaScript, Python or Perl I
would have to write the polymorphic dispatch engine myself and likely
write my output templates in some weird non-XML syntax:
make( "HTML" ) or write( "<HTML>" ) or something.
I spend most of my programming time in a scripting language. I have
already helped design two or three XML/SGML processing packages for that
scripting language. It is my considered opinion that it is *not* the same
unless the scripting language is designed from the ground up to handle
XML: (Omnimark, Balise, DSSSL).
I mean it is theoretically possible that there is a language out there
that just naturally fits XSL-style-processing, but it sure isn't
Javascript. There is a huge amount of information in a simple rule like:
<xsl:template match="B">
<BOLD><xsl:apply-templates/></BOLD>
</xsl:template>
The script-language equivalent would be something like:
pattern = compilePattern( "B" )
function B_template( current_node ){
make_group(
make_element( "BOLD",
dispatch_children( current_node )))
}
xsl_engine.add( pattern, B_template )
Now I fully expect to write code like this in the future. There is a
Python library like this under development already. But I don't believe
that this is as simple to learn as XSL because first you have to learn the
intricacies of a scripting language ("oh, functions can be arguments?")
and then you have to learn the intricacies of the library. You could have
learned XSL directly in less time.
And even so, this code is less amenable to optimization than XSL code is
because you have the full dynamicity of the programming language to deal
with.
--
Paul Prescod - ISOGEN Consulting Engineer speaking for only himself
http://itrc.uwaterloo.ca/~papresco
Alabama's constitution is 100 years old, 300 pages long and has more than
600 amendments. Highlights include "Amendment 393: Amendment of Amendment
No. 351", "Validation of Laws Regulating Court Costs in Randolph County",
"Miscegenation laws", "Bingo Games in Russell County", "Suppression
of dueling". - http://www.legislature.state.al.us/ALISHome.html
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list