The issue with why there’s no DEF/USE reordering in X3DJSAIL and X3DPSAIL apparently stems from Saxon not being able to handle mutable maps/lookup tables.  So let’s build a map per scene, but don’t build it in the X3dTo….xslt, <span style="font-family:-apple-system,sans-serif">but as a generated XSLT map, perhaps in another file, XSLT or not.</span><div dir="auto"><div dir="auto"><br></div><div dir="auto">Perhaps we need to write a preprocessor to map DEF/USE values to a list of XPath expressions in a file per XML scene which allows the DEF node and first USE node for a particular DEF value to be found with an XPath.  If the DEF node isn’t the first XPath for a given DEF/USE value, then the DEF node is swapped with the first USE node with the same DEF value.  We can probably export this as a stylesheet per XML scene.<div dir="auto"><br></div><div dir="auto">Will this actually work?</div><div dir="auto"><br></div><div dir="auto">Criticism welcome!</div><div dir="auto"><br></div><div dir="auto">I’d say Don could probably whip this up really quick if he can retrieve XPaths for all DEF and USE nodes in a scene.  Maybe Vince could as well.  What implementation language do we use?</div><div dir="auto"><br></div><div dir="auto">Do PROTOs affect this?</div><div dir="auto"><br></div><div dir="auto">Sorry for all the emails today!</div><div dir="auto"><br></div><div dir="auto">I finally got outside the box as they used to say.</div><div dir="auto"><br></div><div dir="auto">John </div></div></div>