xml - What can be done when XSLT transformation using msxml doesn't match root node ('/')? -
I'm running XSLT 1.0 conversion using Delphi / MSXML. Like XSLT
& lt; Xsl: stylesheet xmlns: xsl = "http://www.w3.org/1999/XSL/transform" xmlns: msxsl = "vase: schema-microsoft -com: xslt" xmlns: lh = "http: // localhost" Version = "1.0" & gt; & Lt; Xsl: output method = "html" omit-xml-declaration = "yes" indent = "yes" encoding = "ISO-885 9-1" /> & Lt; Xsl: template match = "@ * | node ()" & gt; & Lt; Xsl: applied-template / & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "/" & gt; & Lt; Html & gt; & Lt; Body & gt; & Lt; H2 & gt; My book collection & lt; / H2 & gt; & Lt; Table range = "1" & gt; & Lt; TR & gt; & Lt; Th & gt; Author & lt; / Th & gt; & Lt; Th & gt; Title & lt; / Th & gt; & Lt; / TR & gt; & Lt; Xsl: each selection = "lh: library / LH: book" & gt; & Lt; TR & gt; & Lt; Td> & Lt; Xsl: Select Value = "Author @" /> & Lt; / Td> & Lt; Td> & Lt; Xsl: Select the value = "." /> Gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / XSL: for-each & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;
and XML books.xml
to
& lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; Library xmlns = "http: // localhost" & gt; & Lt; Book author = "Michael Howard" & gt; Secure written code & lt; / Book & gt; & Lt; Book Author = "Michael Kay" & gt; XSLT Reference & lt; / Book & gt; & Lt; / Library & gt;
When I run it, it does not output anything.
Saxon, for reference, receives the following result (1.0 / 2.0 warning message is not included):
& lt; Html xmlns: msxsl = "vase: schemas-microsoft-com: xslt" xmlns: lh = "http: // localhost" & gt; & Lt; Body & gt; & Lt; H2 & gt; My book collection & lt; / H2 & gt; & Lt; Table range = "1" & gt; & Lt; TR & gt; & Lt; Th & gt; Author & lt; / Th & gt; & Lt; Th & gt; Title & lt; / Th & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Michael Howard & lt; / Td> & Lt; Td> Secure written code & lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Michael K & lt; / Td> & Lt; Td> XSLT Reference & lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt;
What can I do about XML (XSLT is not really about to change for me) to deliver the same output as Saxon?
Try to make changes with document nodes; Changes to this line:
XML.DocumentElement.TransformNode (XSL.DocumentElement, Results)
For:
XML.Node.TransformNode (XSL.Node, the result)
If you explicitly call transformNode
on the documentElement
node So I am not surprised that matches = "/"
does not apply.
Comments
Post a Comment