On Mon, Aug 4, 2014 at 12:11 PM, Michael Kay mike(_at_)saxonica(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Question:
Why does it seem xslt is favorite over xQuery?
You might get different answers on a different list.... But I do think
it's true that XSLT continues to have much wider usage than XQuery.
I think the reason for that is primarily that people want to do
transformation (which retains most of the information in a document, but in
different form) rather than query (which extracts small amounts of
information from a document).
Although XQuery is capable of doing transformation, XSLT is better at it
for two reasons:
(a) the built-in rule-based processing model using template rules
(b) the customization capability provided by xsl:import
neither of which have any parallel in XQuery.
XQuery is much better at doing complex joins, but that's not the kind of
processing people are mostly doing.
I like XSLT for outer joins and variants thereof using something that
XQuery doesn't have xsl:key
<xsl:key name="mykey" match="movie" use="@title"/>
<xsl:variable name="doc2" select="doc(doc2.xml)"/>
<xsl:template match="movie[key('mykey',@title,$doc2)"/>
<xsl:template match="movie">
....process unmatched movies
</xsl:template>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--