|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to write (existential) predicates with maps/Wh
On 12.02.2019 15:40, Michael Kay mike@xxxxxxxxxxxx wrote:
I'm having trouble understanding/reproducing this. Can you supply a complete repro? (I.e., the source data that results in this error) The example JSON is e.g. {
"locations" : [
{
"id" : "i1",
"types" : [
{
"name" : "foo"
},
{
"name" : "bar"
}
]
},
{
"id" : "i2",
"types" : [
{
"name" : "baz"
}
]
},
{
"id" : "i3",
"types" : [
{
"name" : "foo"
},
{
"name" : "baz"
}
]
}
]
}If you pass it to the parse-json function and use the result as the context item to the three XPath expressions I have posted then the first one gives that error while the other two return two maps. A complete repro in XSLT is <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="#all" version="3.0"> <xsl:output method="adaptive"/> <xsl:param name="json" as="xs:string">
{
"locations" : [
{
"id" : "i1",
"types" : [
{
"name" : "foo"
},
{
"name" : "bar"
}
]
},
{
"id" : "i2",
"types" : [
{
"name" : "baz"
}
]
},
{
"id" : "i3",
"types" : [
{
"name" : "foo"
},
{
"name" : "baz"
}
]
}
]
}
</xsl:param><xsl:template match="/" name="xsl:initial-template"> <xsl:sequence select="parse-json($json)?locations?*[?types?*[?name = 'foo']]"/> </xsl:template> </xsl:stylesheet> On 11 Feb 2019, at 12:09, Martin Honnen martin.honnen@xxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
|
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
|

Cart








