What's the difference between XSL Pattern and XPath in syntax?

前端 未结 4 1825
青春惊慌失措
青春惊慌失措 2020-12-06 07:13

I\'m updating codes to use MSXML6.0 from MSXML3.0. However, I noticed that, for MSXML3.0, the default \"SelectionLanguage\" is \"XSL Pattern\", while MSXML6.0 only support X

4条回答
  •  醉酒成梦
    2020-12-06 07:39

    The one thing that has tripped me up is selecting the first node in a node set. For example, we'd been using MSXML 3.0 (which uses XSLPattern) and has queries like this:

    /root/book[0]
    

    This query was supposed to select the first book. This works with XSLPattern. But with XPath, this is correct:

    /root/book[1]
    

    So when I switched us to using MSXML 6.0, which uses correct XPath, all those queries with "[0]" stopped working.

    Update: I just found this link that talks some more about XSLPattern and XPath:

    MSDN Magazine: MSXML 3.0 Supports XPath 1.0, XSLT 1.0, XDR, and SAX2

    http://msdn.microsoft.com/en-us/magazine/cc302348.aspx

    Update #2:

    Here's the W3C Spec on XSLT which includes XSL Patterns:

    http://www.w3.org/TR/1998/WD-xsl-19981216.html#AEN376

    Update #3

    Here's another post that describes the same thing I mentioned above:

    http://www.eggheadcafe.com/software/aspnet/29579789/xml-parsing.aspx

提交回复
热议问题