arithmeticus / xml-pantry Goto Github PK
View Code? Open in Web Editor NEWAssorted ideas, studies, and experiments in XML
Assorted ideas, studies, and experiments in XML
If I understand the description "If a key exists already in the map, the new entry is placed in the first appropriate place, otherwise it is added as a topmost map entry" in https://github.com/Arithmeticus/XML-Pantry/blob/master/maps-and-arrays/maps/TAN-fn-maps-extended.xsl#L532 right, a non-existing key value should be added at the top-most level.
However, for a simple test in the form of
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tan="tag:textalign.net,2015:ns"
exclude-result-prefixes="#all">
<xsl:include href="https://github.com/Arithmeticus/XML-Pantry/raw/master/maps-and-arrays/support/support-functions.xsl"/>
<xsl:include href="https://github.com/Arithmeticus/XML-Pantry/raw/master/maps-and-arrays/arrays/TAN-fn-arrays-extended.xsl"/>
<xsl:include href="https://github.com/Arithmeticus/XML-Pantry/raw/master/maps-and-arrays/maps/TAN-fn-maps-extended.xsl"/>
<xsl:output method="json" indent="yes"/>
<xsl:param name="json-string" as="xs:string" expand-text="no">{
"a": { "x": 1,"y": 2 },
"b": 2
}</xsl:param>
<xsl:template match="." name="xsl:initial-template">
<xsl:sequence select="tan:map-put(parse-json($json-string), 'z', 3)"/>
</xsl:template>
</xsl:stylesheet>
I get (using Saxon 10) the result
{
"a": { "x": 1,"y": 2 },
"b": 2
}
where I would have expected
{
"a": { "x": 1,"y": 2 },
"b": 2,
"z": 3
}
Have I misunderstood the function parameters?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.