From: Alexander H. <ah...@xs...> - 2013-10-10 17:56:30
|
> [resend] Any word on this? Begin doorgestuurd bericht: > Van: Alexander Henket <ah...@xs...> > Onderwerp: [Exist-open] Different behavior for util:node-xpath() > Datum: 3 oktober 2013 01:17:23 CEST > Aan: exi...@li... > > > We used to work with a pre-release version of exist 1.5 where the function util:node-xpath(). Now on exist 2.1 we are seeing something new in this function. What we want to do is extract xml from a file at a given xpath expression so we look for: > doc($somedoc)//*[util:node-xpath(.)=$somexpath] > > Under exist 2.1 this fails because there is some extra non-printable in the path the node-path() returns some how, but only when there's a @schemaLocation on that node. Adding normalize-space() seems to circumvent. > > This looks like a bug to me. > > To reproduce: > > xquery version "1.0"; > > let $t1 := <REPC_IN990003NL xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 ../schemas/REPC_IN990003NL.xsd"/> > let $t2 := <REPC_IN990003NL xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> > > let $x1 := '/REPC_IN990003NL[@xsi:schemaLocation eq "urn:hl7-org:v3 ../schemas/REPC_IN990003NL.xsd"][@xmlns: eq "urn:hl7-org:v3"][@xmlns:xsi eq "http://www.w3.org/2001/XMLSchema-instance"]' > let $x2 := '/REPC_IN990003NL[@xmlns: eq "urn:hl7-org:v3"][@xmlns:xsi eq "http://www.w3.org/2001/XMLSchema-instance"]' > > let $r1 := $t1/util:node-xpath(.) > let $r2 := $t2/util:node-xpath(.) > > return > <r> > <p1>{$r1}</p1> > <p2>{$x1}</p2> > <p>Equal before normalize? {$r1=$x1}</p> > <p>Equal after normalize ? {normalize-space($r1)=$x1}</p> > <hr>--------------</hr> > <p1>{$r2}</p1> > <p2>{$x2}</p2> > <p>Equal? {$r2=$x2}</p> > <hr>--------------</hr> > </r> > > Output > > <r> > <p1>/REPC_IN990003NL[@xsi:schemaLocation eq "urn:hl7-org:v3 ../schemas/REPC_IN990003NL.xsd"][@xmlns: eq "urn:hl7-org:v3"][@xmlns:xsi eq "http://www.w3.org/2001/XMLSchema-instance"]</p1> > <p2>/REPC_IN990003NL[@xsi:schemaLocation eq "urn:hl7-org:v3 ../schemas/REPC_IN990003NL.xsd"][@xmlns: eq "urn:hl7-org:v3"][@xmlns:xsi eq "http://www.w3.org/2001/XMLSchema-instance"]</p2> > <p>Equal before normalize? false</p> > <p>Equal after normalize ? true</p> > <hr>--------------</hr> > <p1>/REPC_IN990003NL[@xmlns: eq "urn:hl7-org:v3"][@xmlns:xsi eq "http://www.w3.org/2001/XMLSchema-instance"]</p1> > <p2>/REPC_IN990003NL[@xmlns: eq "urn:hl7-org:v3"][@xmlns:xsi eq "http://www.w3.org/2001/XMLSchema-instance"]</p2> > <p>Equal? true</p> > <hr>--------------</hr> > </r> > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk_______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open |