On Tue, Aug 30, 2022 at 08:28:58PM -0400, Tom Lane wrote: > Hmm, I see that function declared in <xpathInternals.h>, which > sure doesn't give me a warm feeling that we're supposed to call it > directly. But maybe there's an approved way to get the result. > > Or perhaps this test case is wrong, and instead of "node()" we > need to write something that specifies a sorted result?
I am no specialist on this matter.. Still, looking around, this looks to be the kind of job that xsl:sort would do? We cannot use it here for an XML-only context, though, and it does not seem like there is a direct way to enforce the ordering per the nature of the XPath language, either. I may be missing something of course. Please note that I am also getting a bit the cold feet with the idea of enforcing a sorting of the elements in the generated output, actually, as this could have a performance penalty for all users particularly on large blobs of data. At the end, I'd like to think that it would be wiser to just remove entirely the test for node() or reduce the contents of the string to be able to strictly control the output order (say a simple '<e>pre<![CDATA[&ent1]]>post</e>' would do the trick). I cannot think about a better idea now. Note that removing the test case where we have node() has no impact on the coverage of xml.c. -- Michael
signature.asc
Description: PGP signature