<div dir="auto">I get that USE *may* reduce complexity, but here I am dealing with DEF/<span style="font-size:inherit">USE</span><br> being out of order because people want me to comply with a vendor lock-in of field ordering.  Plus they’re capable of dealing with complex recursive data structures and algorithms, user interfaces and stumble at a map/object?  Is that an XSLT issue?</div><div dir="auto"><br></div><div dir="auto">Please Google “<span style="font-size:inherit">How to implement a map or object in Saxon?” And figure out the best way to use it.</span></div><div dir="auto"><span style="font-size:inherit"><br></span></div><div dir="auto">Consider:</div><div dir="auto"><br></div><div dir="auto"><div style="font-size:inherit"><xsl:variable name="updatedMap" select="map:put($myMap, 'newKey', 'newValue')"/><br style="font-size:inherit"></div><br></div><div dir="auto">Apparently, maps are immutable??, so you have to create a new one to update.  Maybe ask Saxonica for a mutable map?</div><div dir="auto"><br></div><div dir="auto">I don’t understand why you would want to work  with XSLT, again.  Let’s look at the stylesheet to Java converter some more, perhaps.  If you don’t like programming, that’s totally understandable.   That’s often where AI can help advanced people.  That’s pretty much how I created the converter.</div><div dir="auto"><br></div><div dir="auto">I don’t think you need a map in Saxon, though, Python/Java should work ok.</div><div dir="auto"><br></div><div dir="auto">Just implement a DEF/USE to node reference lookup map and be done with it.  You can look up the unique node’s DEF/USE by calling node.getDEF() or node.getUSE().  They should be the same value.  If there’s no entry in the map when outputting, put out DEF, and put an entry in the map, if there’s an entry, then output a USE instead of a map.  If you need to include a namespace in the map, create a namespaces to DEF/USE lookup map map.</div><div dir="auto"><br></div><div dir="auto"><div style="font-size:inherit"><a href="https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/util/HashMap.html" style="font-size:inherit">https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/util/HashMap.html</a></div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">Maybe add a reference count if you’re worried about reclaiming memory.  If the reference count goes to zero, remove the entry in the DEF/USE map.  Create a tiny object to hold the reference count and the node reference, and put that in the DEF/USEmap instead of the node reference alone.</div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">I can map out the Java code if you like:</div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">public Node get(String namespace, String DEFUSE) // returns Node in namespace if DEF/USE present in namespace, otherwise null </div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">public boolean put(String namespace, String DEFUSE, Node node) // increments count to 1, returns false if node already exists, otherwise true, puts node in namespace at DEFUSE.</div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">There’s probably SAI for the above.</div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto"><div style="font-size:inherit" dir="auto"><span style="font-size:inherit;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important;background-color:rgba(0,0,0,0);border-color:rgb(0,0,0);color:rgb(0,0,0)">public int getCount(String namespace, String DEFUSE) // get number of references </span></div><div style="font-size:inherit" dir="auto"><span style="font-size:inherit;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important;background-color:rgba(0,0,0,0);border-color:rgb(0,0,0);color:rgb(0,0,0)"><br></span></div><div style="font-size:inherit" dir="auto">public void setCount<span style="font-size:inherit;background-color:rgba(0,0,0,0);border-color:rgb(0,0,0);color:rgb(0,0,0)">(String namespace, String DEFUSE) // set the reference count </span></div></div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">public void incrementCount(String namespace, String DEFUSE) // increment reference count</div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">public int decrementCount(String namespace, String DEFUSE) // decrement and returns Node’s reference count. Stops at zero and nulls stored Node.</div><div style="font-size:inherit" dir="auto"><br></div><div style="font-size:inherit" dir="auto">Maybe send Saxonica this specification and see what they can suggest.</div><div style="font-size:inherit" dir="auto"><br></div></div><div dir="auto">John <br></div><div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Mar 27, 2026 at 8:22 PM Don Brutzman <<a href="mailto:don.brutzman@gmail.com">don.brutzman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div>It is not possible to avoid USE, it is fully integrated functionality in the specification.  No need to reengineer the specification.</div><div><br></div><div>Again recommend working on one very simple case at a time, to narrow down each problem and fix it.  Complexity obscures diagnosis.</div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)"><br></font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">all the best, Don</font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">-- </font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">X3D Graphics, Maritime Robotics, Distributed Simulation</font></div><div style="color:rgb(34,34,34)"><font face="monospace" style="font-family:monospace;color:rgb(34,34,34)">Relative Motion Consulting  <a href="https://RelativeMotion.info" target="_blank" style="font-family:monospace">https://RelativeMotion.info</a></font></div></div></div></div><br></div><br><div class="gmail_quote"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 27, 2026 at 6:08 PM John Carlson via x3d-public <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Replacing USE with DEF would massively improve the JSON schema.   I vote for that!   It would massively improve the error reporting as well.<div dir="auto"><br></div><div dir="auto">What does FreeWRL think?</div><div dir="auto"><br></div><div dir="auto">No need for two attributes for the same meaning.</div><div dir="auto"><br></div><div dir="auto">USE and DEF code be used interchangeably, and container fields could specify parents.</div><div dir="auto"><br></div><div dir="auto">The only problem I see is when USE and DEF are used together, but that’s already an issue.</div><div dir="auto"><br></div><div dir="auto">John</div></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div>
</blockquote></div></div>