Re: parse-xml-fragment() Fails in Saxon 9.5 but not in 9.8
Eliot Kimber <ekimber-xb9TSTQ6enFWk0Htik3J/[email protected]> Fri, 15 Jan 2021 13:27:31 -0600
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
The Saxon 9.5 documentation includes the parse-xml() and parse-xml-fragment() functions as supported--9.5 was an early implementation of the not-yet-complete XSLT 3 spec. So it's not surprising that there might be bugs in the implementation in that version. It's long been superceded of course, but due to circumstances way beyond my control, I am stuck with Saxon 9.5 for this project. To be honest I hadn't taken the time to fully understand what David was suggesting. I can try that. Cheers, E. -- Eliot Kimber http://contrext.com On 1/15/21, 1:15 PM, "Martin Honnen" <[email protected]> wrote: On 15.01.2021 18:03, Eliot Kimber wrote: > I realize this is another "help me with a version you never want to think about again question" but I have to ask it. > > Per my recent post on the XSLT list, I'm using saxon:parse-pseudo-attribute() function to get the value of an Oxygen delete PI @content attribute, which contains escaped XML markup. > > Using this code: > > <xsl:variable name="rawMarkup" as="xs:string" select="saxon:parse-pseudo-attribute('content')"/> > <xsl:variable name="deletedMarkup" as="element"> > <deletedMarkup xmlns=""> > <xsl:sequence select="parse-xml-fragment($rawMarkup)"/> > </deletedMarkup> > </xsl:variable> > > <xsl:apply-templates select="$deletedMarkup" mode="handle-deleted-markup"/> > > it works perfectly with Saxon 9.8. > > However, with Saxon 9.5 I get these errors: > > Error reported by XML parser processing > file:/home/kimberw/workspace/nbs/src/xslt/gaonb-pe/preProcessPhase.xsl: Scanner State 24 > not Recognized > Error on line 109 of preProcessPhase.xsl: > FODC0006: First argument to parse-xml-fragment() is not a well-formed and > namespace-well-formed XML fragment. XML parser reported: Error reported by XML parser > > With Saxon 9.5 I can write the value of $rawMarkup to a file and see that it is in fact well-formed XML, but of course there's no way that Oxygen would not put well-formed XML here. > > Given that Saxon 9.5 is required for this application, any idea if there's any workaround for this particular error? I am kind of surprised 9.5 supports parse-xml or parse-xml-fragment and I am not sure where the error comes from. Does David's suggestion the XSL list to not use the saxon:parse-pseudo-attribute function but instead throw the value of the pi as the attribute part of an on the fly constructed element tag with parse-xml(parse-xml(concat('<x ',.,'/>'))/x/@content) perhaps work better? _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ [email protected] https://lists.sourceforge.net/lists/listinfo/saxon-help _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ [email protected] https://lists.sourceforge.net/lists/listinfo/saxon-help