<div dir="ltr">I don't know what normalize-space does right now, but I trust you!  Your results look good, Thanks!<div><br></div><div>I may follow-with testing later.  I'd like to include a JSON patch based on your patch.</div><div><br></div><div>John</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 5, 2022 at 11:28 AM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="gmail-m_8242336299099317WordSection1"><p class="MsoNormal" style="margin-left:0.25in">[Summary: X3D to Python MFBool conversion problem fixed.]<u></u><u></u></p><p class="MsoNormal" style="margin-left:0.25in"><u></u> <u></u></p><ol style="margin-top:0in" start="1" type="1"><li class="gmail-m_8242336299099317MsoListParagraph">Thanks for diagnosis and focus on correct code block.  The actual conversion problem was failure to normalize whitespace (including original commas) before changing blank characters to comma separators in final output.  Thus multiple blank and comma characters (which together are allowed whitespace in the XML output) were previously getting converted to multiple commas, ouch.<u></u><u></u></li></ol><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Revised XSLT:<u></u><u></u></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><xsl:variable name="commaSeparatedMFBool" select="translate(normalize-space(translate(translate(translate(string($x3dValue),'f','F'),'t','T'),',',' ')),' ',',')"/><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I modified a test scene and checked the converted output:<u></u><u></u></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><a href="https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.x3d" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.x3d</a><u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><a href="https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.py" target="_blank">https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.py</a><br><br><u></u><u></u></li></ul><p class="MsoNormal">Revised model excerpts and correct output with diagnostic turned on:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><BooleanSequencer DEF='LeftViewBinder' key='0 0.1 0.25' keyValue='false true false'/><u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><BooleanSequencer DEF='BackViewBinder' key='0 0.375 0.475' keyValue='false, true, false'/><u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><BooleanSequencer DEF='RightViewBinder' key='0 0.5 0.6' keyValue='false , true , false'/><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">create python:<u></u><u></u></p><p class="MsoNormal">C:\x3d-code\<a href="http://www.web3d.org" target="_blank">www.web3d.org</a>\x3d\content\examples\Basic/development//BooleanSequencerExample.x3d processing with X3dToPython stylesheet...<u></u><u></u></p><p class="MsoNormal">*** MFBool handling, $x3dValue='false true false, $commaSeparatedMFBool='False,True,False<u></u><u></u></p><p class="MsoNormal">*** MFBool handling, $x3dValue='false, true, false, $commaSeparatedMFBool='False,True,False<u></u><u></u></p><p class="MsoNormal">*** MFBool handling, $x3dValue='false , true , false, $commaSeparatedMFBool='False,True,False<u></u><u></u></p><div><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""><u></u> <u></u></span></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">BooleanSequencer(DEF='LeftViewBinder',key=[0,0.1,0.25],keyValue=[False,True,False]),<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">BooleanSequencer(DEF='BackViewBinder',key=[0,0.375,0.475],keyValue=[False,True,False]),<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">BooleanSequencer(DEF='RightViewBinder',key=[0,0.5,0.6],keyValue=[False,True,False]),<u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Original test scene goes back to original state, since X3D Canonicalization (C14N) changes those pesky commas back into single blank characters.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">ISO/IEC 19776-3, Extensible 3D (X3D) encodings, Part 3: Compressed binary encoding<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">Annex 4 Concepts, Clause 4.2.3 X3D canonical form<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><a href="https://www.web3d.org/documents/specifications/19776-3/V3.3/Part03/concepts.html#X3DCanonicalForm" target="_blank">https://www.web3d.org/documents/specifications/19776-3/V3.3/Part03/concepts.html#X3DCanonicalForm</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">X3D Canonicalizer<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><a href="https://svn.code.sf.net/p/x3d/code/www.web3d.org/x3d/tools/canonical/doc/x3dTools.htm" target="_blank">https://svn.code.sf.net/p/x3d/code/www.web3d.org/x3d/tools/canonical/doc/x3dTools.htm</a><u></u><u></u></li></ul><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">X3dToPython.xslt stylesheet committed, changes should be good for you now.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><ol style="margin-top:0in" start="2" type="1"><li class="gmail-m_8242336299099317MsoListParagraph">Regarding rephrased tooltip for MFBool: please note<u></u><u></u></li></ol><ol style="margin-top:0in" start="1" type="a"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">All such hints are similarly / identically phrased for maintainability,<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">All tooltip hints are for XML encoding, too easily confused otherwise.<u></u><u></u></li></ol><p class="gmail-m_8242336299099317MsoListParagraph"><u></u> <u></u></p><ul style="margin-top:0in" type="disc"><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">X3D4 Tooltips, FieldTypesTable<u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in"><a href="https://www.web3d.org/x3d/tooltips/X3dTooltips.html#FieldTypesTable" target="_blank">https://www.web3d.org/x3d/tooltips/X3dTooltips.html#FieldTypesTable</a> <u></u><u></u></li><li class="gmail-m_8242336299099317MsoListParagraph" style="margin-left:0in">For MFBool:<u></u><u></u></li></ul><p class="gmail-m_8242336299099317MsoListParagraph"><b><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:rgb(68,119,119);background:rgb(153,204,204)">Hint:</span></b><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black;background:rgb(153,204,204)"> comma characters are allowed as whitespace between individual SFBool values in the list.</span><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black"><br></span><b><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:rgb(68,119,119);background:rgb(153,204,204)">Hint:</span></b><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black;background:rgb(153,204,204)"> comma characters are not included in canonical form.</span><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">So I think we are good.  Again thanks for a helpful catch.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">all the best, Don<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-- <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Don Brutzman  Naval Postgraduate School, Code USW/Br        <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">X3D graphics, virtual worlds, Navy robotics https://</span> <span style="font-size:10pt;font-family:"Courier New""><a href="http://faculty.nps.edu/brutzman" target="_blank">faculty.nps.edu/brutzman</a><u></u><u></u></span></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> <br><b>Sent:</b> Monday, July 4, 2022 7:25 PM<br><b>To:</b> Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>>; <a href="mailto:holger.seelig@gmail.com" target="_blank">holger.seelig@gmail.com</a><br><b>Subject:</b> Re: [Remaining Work] X3dToPython.xslt, BooleanSequencer keyValue<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">Code in question in X3dToPython.xslt, I think, for MFBool's. <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">            <xsl:when test="($x3dType = 'MFBool')"><br>                <!-- Python boolean values are True and False, comma-separated list --><br>                <xsl:value-of select="translate(translate(translate(string($x3dValue),'f','F'),'t','T'),' ',',')"/><br>            </xsl:when><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Spaces are translated to ',', i think, to "true, false" in XML gets translated to "True,,False" in Python.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I don't know how to fix this yet (I'm an XSLT plebe), except fix the XML so Python will work okay.  Maybe we should put a feature request into Saxon or ask for help?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">At this point, my suggestion would be to fall back to some kind of regular expression replacement?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Or what I would do in sed, like:<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">s/,+/,/g<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">and<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">s/ +/ /g<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">between SFBools<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">One may wish to put \s or \S , from more advanced regular expressions, and only allow one comma between SFBools in the MFBool.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I don't know if XSLT supports any of this.  Check out this table for XSLT 2.0?  Is this accurate?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fflylib.com%2Fbooks%2Fen%2F2.424.1.122%2F1%2F&data=05%7C01%7Cbrutzman%40nps.edu%7Cfebd8a7a066b4c06d29108da5e2d9806%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637925847160880998%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AfjPGqSrV4%2BwpPzxROzihR3yWwKSRezo89pEJWCXU3g%3D&reserved=0" target="_blank">16.4 Using Regular Expressions | Learning XSLT (flylib.com)</a><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Did a little googling, found this:<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F35840063%2Fxslt-regular-expression-replace&data=05%7C01%7Cbrutzman%40nps.edu%7Cfebd8a7a066b4c06d29108da5e2d9806%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637925847160880998%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YogJt1t6CIIgoer9GrMVA7rfWfN7RGU7wieOdYT714Y%3D&reserved=0" target="_blank">regex - XSLT + regular expression replace - Stack Overflow</a> (analyze-string)<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Perhaps a few of us could attend an advanced XSLT course?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Maybe we could have a learning session?  I only see one analyze-string in our XSLT code base.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Could be a big win, would be my guess.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Or we could use SNOBOL or its derivative, Icon. <a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FIcon_%2528programming_language%2529&data=05%7C01%7Cbrutzman%40nps.edu%7Cfebd8a7a066b4c06d29108da5e2d9806%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637925847160880998%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QzM1Glrkto0CBwqHC6wZ6zx6ecYDM7vzLFvavlL7u%2BA%3D&reserved=0" target="_blank">Icon (programming language) - Wikipedia</a> (see "Dialects" and "Influenced" for additional features, some 3D).<u></u><u></u></p></div><div><p class="MsoNormal"><br>I studied Icon in school, and it was a good language, I didn't run into any snafu's with our problem set solutions.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I would recommend Icon over XML, XSLT, Python and JavaScript, if anyone cares, at least for text processing.  I didn't do 3D with Icon.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">John<u></u><u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jul 4, 2022 at 8:18 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><p class="MsoNormal">Trying to help...For MFBool in X3d tooltips, perhaps rephrase whitespace as below, for both XML, JSON and Python (and perhaps others). <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><b><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:rgb(68,119,119);background:rgb(153,204,204)">Hint:</span></b><span style="font-size:13.5pt;font-family:"Times New Roman",serif;color:black;background:rgb(153,204,204)"> a single comma character is allowed as whitespace between individual SFBool values in the list.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:black;background:white">Sorry, I apologize for bringing up MFStrings.  I was in the wrong.</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jul 4, 2022 at 7:53 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><p class="MsoNormal">If commas are not allowed in XML for MFBool, then Holger needs to change her particle system code. <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jul 4, 2022 at 7:49 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal">Note: Please clarify MFBool. I will look again at recent emails.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">My understanding is that SFBool values can be separated by /, / comma followed by space in an MFBool in XML (comma as whitespace). What I'm not understanding is the Python output from X3dToPython.xslt, which puts out commas next to each other (comma not as whitespace).  See below.<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jul 4, 2022 at 4:56 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal">Note extra commas in MFBool outputs from X3dToPython.xslt and X3dToJson.xslt.<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Mon, Jul 4, 2022 at 4:23 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><p class="MsoNormal">Note, the following examples are unvalidated. Beware! <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">For example, from:  <a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcreate3000%2FLibrary%2Fmain%2FTests%2FComponents%2FParticleSystems%2FBoundedPhysicsModel.x3d&data=05%7C01%7Cbrutzman%40nps.edu%7Cfebd8a7a066b4c06d29108da5e2d9806%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637925847160880998%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YNS4TaXeAD7d0Cznh6VzX5gD81gEsGo6g7rGkaFV90g%3D&reserved=0" target="_blank">https://raw.githubusercontent.com/create3000/Library/main/Tests/Components/ParticleSystems/BoundedPhysicsModel.x3d</a> <u></u><u></u></p><div><p class="MsoNormal">    <BooleanSequencer DEF='_4'<br>        key='0, 0.3, 1'<br>        keyValue='true, false'/><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal">And python:<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">BooleanSequencer(DEF='_4',key=[0,0.3,1],keyValue=[True,,False]),<u></u><u></u></p></div></div></blockquote></div></div></blockquote></div></div></blockquote></div></blockquote></div></blockquote></div></div></div></div></blockquote></div>