[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Why does this XPath expression work fine when run in
Hi Folks, Below is a sample XHTML document. Immediately following the <style> element is a comment. I want to ensure that the value in the comment starts with this string: [if gte mso 9]><xml> Using Oxygen, I ran the following XPath query (the <head> element is the context node): *[local-name() eq 'style']/following-sibling::comment()[1]/starts-with(., '[if gte mso 9]><xml>') The result of running the query is: true() Perfect! Next, I put the query into an XML Schema 1.1 assert element: <xs:assert test="*[local-name(.) eq 'style']/following-sibling::comment()[1]/starts-with(., '[if gte mso 9]><xml>')" /> When I validated the XHTML document against the XML Schema, I got this error: Assertion evaluation ('*[local-name(.) eq 'style']/following-sibling::comment()[1]/starts-with(., '[if gte mso 9]><xml>')') for element 'head' on schema type 'headType' did not succeed. Why does the XPath query work fine when run in Oxygen but fails when used in an XSD 1.1 assert element? /Roger Here's the XHTML document: <html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <head> <meta name="generator" content="HTML Tidy for HTML5 for Windows version 5.6.0" /> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta name="Generator" content="Microsoft Word 15 (filtered medium)" /> <style> <![CDATA[ <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri",sans-serif;} This is hidden text a:link, span.MsoHyperlink {mso-style-priority:99; color:#0563C1; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:#954F72; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri",sans-serif; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri",sans-serif;} @page WordSection1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in;} div.WordSection1 {page:WordSection1;} --> ]]> </style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026"> <o:colormenu v:ext="edit" fillcolor="none [671]" /> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--> <title></title> </head> <body lang="EN-US" bgcolor="#D5DCE4" link="#0563C1" vlink="#954F72" xml:lang="EN-US"> <div class="WordSection1"> <p class="MsoNormal">Dfsdfsdf</p> <p class="MsoNormal"></p> <p> </p> <p class="MsoNormal">Fdsfsdf</p> <p class="MsoNormal"></p> <p> </p> <p class="MsoNormal">Fdfjdklfs</p> <p class="MsoNormal"></p> <p> </p> <p class="MsoNormal"></p> <p> </p> </div> </body> </html>
|
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
|