Code Monkey home page Code Monkey logo

xml-pantry's People

Contributors

arithmeticus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

xml-pantry's Issues

Top level entry not added

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.