media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources

talk show tell print

vr-x3d-vrml.xsl


  <?xml version='1.0'?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                  xmlns:saxon="http://icl.com/saxon" saxon:trace="no">
  
  <!--        XSL namespaces are in transition!  Tools are slow to catch up.
      ***        Edit the topmost stylesheet tag on line 2 of this file to match the xmlns namespace URI for your XSL tool. ***
          W3C:
          Saxon:           <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
          IBM XSLEditor:   <xsl:stylesheet xmlns:xsl='http://www.w3.org/XSL/Transform/1.0'>
          IE 5:            <xsl:stylesheet xmlns:xsl='http://www.w3.org/TR/WD-xsl'>
          XT:              <xsl:stylesheet xmlns:xsl='http://www.w3.org/XSL/Transform'>
  -->
  
  <!--
    <head>
     <meta name="filename"    		content="X3dToVrml97.xsl" />
     <meta name="author"      		content="Don Brutzman" />
     <meta name="LatticeXvl author"	content="Marc Jablonski" />
     <meta name="revised"     		content="21 February 2002" />
     <meta name="description" content="XSL stylesheet to convert X3D files to VRML 97 format, fourth draft matching x3d-compromise.dtd" />
     <meta name="url"         content="http://www.web3D.org/TaskGroups/x3d/translation/X3dToVrml97.xsl" />
    </head>
  
  Recommended tool:
  
   SAXON XML Toolkit (and Instant Saxon) from Michael Kay of ICL, saxon.sourceforge.net
  
  Can also be used with Apache server
  
  -->
  
  <!-- Problems and bugs:
  
    - Script node content hardwired for javascript to eliminate problematic leading whitespace (which crashes CosmoPlayer)
    - still need to check KeySensor, StringSensor, GeoVRML attribute defaults
    - combine GeoVRML and H-Anim metadata attributes into a single string
    - ensure Double types get translated properly!
  
    -->
  
  <xsl:strip-space elements="*" />
  <xsl:output method="text" encoding="utf-8" media-type="model/vrml" indent="no" cdata-section-elements="Script"/>
  <!-- omit-xml-declaration="yes" -->
  <!-- indent handled as a passed parameter since output-tag indent ineffective -->
  
  <!-- ****** root:  start of file ****** -->
  <xsl:template match="/">
    <!-- VRML 97 header -->
    <xsl:text>
    <!-- VRML 200x headers -->
    <xsl:apply-templates select="X3D"/>
    <xsl:apply-templates select="X3D/component"/>
    <xsl:if test="X3D/head">
      <xsl:text>&#10;</xsl:text>
      <xsl:apply-templates select="X3D/head"/>
      <xsl:text>&#10;</xsl:text>
    </xsl:if>
    <xsl:if test="X3D/Header">
      <xsl:call-template name="output-error">
        <xsl:with-param name="errorString">
          <xsl:text>Header tag illegal, use head instead</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="node">
          <xsl:text>X3D/Header</xsl:text>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:if>
    <!-- VRML 97 header -->
    <!-- Insert GeoVrml EXTERNPROTO declarations, if not otherwise provided -->
    <xsl:if test="//GeoCoordinate and not(//ExternProtoDeclare[@name='GeoCoordinate']) and not(//ProtoDeclare[@name='GeoCoordinate'])">
      <xsl:text>EXTERNPROTO GeoCoordinate [&#10;</xsl:text>
      <xsl:text>  field  SFNode    geoOrigin    # NULL&#10;</xsl:text>
      <xsl:text>  field  MFString  geoSystem    # [ "GDC" ]&#10;</xsl:text>
      <xsl:text>  field  MFString  point        # []&#10;</xsl:text>
      <xsl:text>] [&#10;</xsl:text>
      <xsl:text>    "C:\Program Files\GeoVRML\1.0\protos\GeoCoordinate.wrl#GeoCoordinate"&#10;</xsl:text>
      <xsl:text>    "file: 
C|/Program Files/GeoVRML/1.0/protos/GeoCoordinate.wrl#GeoCoordinate"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoCoordinate.wrl#GeoCoordinate"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoCoordinate.wrl#GeoCoordinate"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoElevationGrid and not(//ExternProtoDeclare[@name='GeoElevationGrid']) and not(//ProtoDeclare[@name='GeoElevationGrid'])"> <xsl:text>EXTERNPROTO GeoElevationGrid [&#10;</xsl:text> <xsl:text> field SFNode geoOrigin # NULL&#10;</xsl:text> <xsl:text> field MFString geoSystem # [ "GDC" ]&#10;</xsl:text> <xsl:text> field SFString geoGridOrigin # "0 0 0"&#10;</xsl:text> <xsl:text> field SFInt32 xDimension # 0&#10;</xsl:text> <xsl:text> field SFString xSpacing # "1.0"&#10;</xsl:text> <xsl:text> field SFInt32 zDimension # 0&#10;</xsl:text> <xsl:text> field SFString zSpacing # "1.0"&#10;</xsl:text> <xsl:text> field SFFloat yScale # 1.0&#10;</xsl:text> <xsl:text> field MFFloat height # []&#10;</xsl:text> <xsl:text> eventIn SFFloat set_yScale&#10;</xsl:text> <xsl:text> eventIn MFFloat set_height&#10;</xsl:text> <xsl:text> exposedField SFNode color # NULL&#10;</xsl:text> <xsl:text> exposedField SFNode texCoord # NULL&#10;</xsl:text> <xsl:text> exposedField SFNode normal # NULL&#10;</xsl:text> <xsl:text> field SFBool normalPerVertex # TRUE&#10;</xsl:text> <xsl:text> field SFBool ccw # TRUE&#10;</xsl:text> <xsl:text> field SFBool colorPerVertex # TRUE&#10;</xsl:text> <xsl:text> field SFFloat creaseAngle # 0&#10;</xsl:text> <xsl:text> field SFBool solid # TRUE&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoElevationGrid.wrl#GeoElevationGrid"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoElevationGrid.wrl#GeoElevationGrid"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoElevationGrid.wrl#GeoElevationGrid"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoElevationGrid.wrl#GeoElevationGrid"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoInline and not(//ExternProtoDeclare[@name='GeoInline']) and not(//ProtoDeclare[@name='GeoInline'])"> <xsl:text>EXTERNPROTO GeoInline [&#10;</xsl:text> <xsl:text> field MFString url # []&#10;</xsl:text> <xsl:text> eventIn MFString set_url &#10;</xsl:text> <xsl:text> eventOut MFString url_changed&#10;</xsl:text> <xsl:text> field SFBool load # TRUE&#10;</xsl:text> <xsl:text> eventIn SFBool set_load&#10;</xsl:text> <xsl:text> eventOut SFBool load_changed&#10;</xsl:text> <xsl:text> field SFVec3f bboxCenter # 0 0 0&#10;</xsl:text> <xsl:text> field SFVec3f bboxSize # -1 -1 -1&#10;</xsl:text> <xsl:text> eventOut MFNode children&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoInline.wrl#GeoInline"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoInline.wrl#GeoInline"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoInline.wrl#GeoInline"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoInline.wrl#GeoInline"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoLocation and not(//ExternProtoDeclare[@name='GeoLocation']) and not(//ProtoDeclare[@name='GeoLocation'])"> <xsl:text>EXTERNPROTO GeoLocation [&#10;</xsl:text> <xsl:text> field SFNode geoOrigin # NULL&#10;</xsl:text> <xsl:text> field MFString geoSystem # [ "GDC" ]&#10;</xsl:text> <xsl:text> field SFString geoCoords # ""&#10;</xsl:text> <xsl:text> eventIn SFString set_geoCoords&#10;</xsl:text> <xsl:text> eventOut SFString geoCoords_changed&#10;</xsl:text> <xsl:text> field MFNode children # []&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoLocation.wrl#GeoLocation"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoLocation.wrl#GeoLocation"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoLocation.wrl#GeoLocation"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoLocation.wrl#GeoLocation"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoLOD and not(//ExternProtoDeclare[@name='GeoLOD']) and not(//ProtoDeclare[@name='GeoLOD'])"> <xsl:text>EXTERNPROTO GeoLOD [&#10;</xsl:text> <xsl:text> field MFString rootUrl # []&#10;</xsl:text> <xsl:text> field MFNode rootNode # []&#10;</xsl:text> <xsl:text> field MFString child1Url # []&#10;</xsl:text> <xsl:text> field MFString child2Url # []&#10;</xsl:text> <xsl:text> field MFString child3Url # []&#10;</xsl:text> <xsl:text> field MFString child4Url # []&#10;</xsl:text> <xsl:text> field SFFloat range # 10&#10;</xsl:text> <xsl:text> field SFNode geoOrigin # NULL&#10;</xsl:text> <xsl:text> field MFString geoSystem # [ "GDC" ]&#10;</xsl:text> <xsl:text> field SFString center # ""&#10;</xsl:text> <xsl:text> eventOut MFNode children&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoLOD.wrl#GeoLOD"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoLOD.wrl#GeoLOD"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoLOD.wrl#GeoLOD"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoLOD.wrl#GeoLOD"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoMetadata and not(//ExternProtoDeclare[@name='GeoMetadata']) and not(//ProtoDeclare[@name='GeoMetadata'])"> <xsl:text>EXTERNPROTO GeoMetadata [&#10;</xsl:text> <xsl:text> exposedField MFString url # []&#10;</xsl:text> <xsl:text> exposedField MFString summary # []&#10;</xsl:text> <xsl:text> exposedField MFNode data # []&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoMetadata.wrl#GeoMetadata"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoMetadata.wrl#GeoMetadata"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoMetadata.wrl#GeoMetadata"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoMetadata.wrl#GeoMetadata"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoOrigin and not(//ExternProtoDeclare[@name='GeoOrigin']) and not(//ProtoDeclare[@name='GeoOrigin'])"> <xsl:text>EXTERNPROTO GeoOrigin [&#10;</xsl:text> <xsl:text> exposedField MFString geoSystem # [ "GDC" ]&#10;</xsl:text> <xsl:text> exposedField SFString geoCoords # ""&#10;</xsl:text> <xsl:text> field SFBool rotateYUp # FALSE&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoOrigin.wrl#GeoOrigin"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoOrigin.wrl#GeoOrigin"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoOrigin.wrl#GeoOrigin"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoOrigin.wrl#GeoOrigin"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoPositionInterpolator and not(//ExternProtoDeclare[@name='GeoPositionInterpolator']) and not(//ProtoDeclare[@name='GeoPositionInterpolator'])"> <xsl:text>EXTERNPROTO GeoPositionInterpolator [&#10;</xsl:text> <xsl:text> field SFNode geoOrigin # NULL&#10;</xsl:text> <xsl:text> field MFString geoSystem # [ "GDC" ]&#10;</xsl:text> <xsl:text> field MFFloat key # []&#10;</xsl:text> <xsl:text> field MFString keyValue # []&#10;</xsl:text> <xsl:text> eventIn SFFloat set_fraction&#10;</xsl:text> <xsl:text> eventOut SFVec3f value_changed&#10;</xsl:text> <xsl:text> eventOut SFString geovalue_changed&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoPositionInterpolator.wrl#GeoPositionInterpolator"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoPositionInterpolator.wrl#GeoPositionInterpolator"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoPositionInterpolator.wrl#GeoPositionInterpolator"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoPositionInterpolator.wrl#GeoPositionInterpolator"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoTouchSensor and not(//ExternProtoDeclare[@name='GeoTouchSensor']) and not(//ProtoDeclare[@name='GeoTouchSensor'])"> <xsl:text>EXTERNPROTO GeoTouchSensor [&#10;</xsl:text> <xsl:text> field SFNode geoOrigin # NULL&#10;</xsl:text> <xsl:text> field MFString geoSystem # [ "GDC" ]&#10;</xsl:text> <xsl:text> exposedField SFBool enabled # TRUE&#10;</xsl:text> <xsl:text> eventOut SFVec3f hitNormal_changed&#10;</xsl:text> <xsl:text> eventOut SFVec3f hitPoint_changed&#10;</xsl:text> <xsl:text> eventOut SFVec2f hitTexCoord_changed&#10;</xsl:text> <xsl:text> eventOut SFBool isActive&#10;</xsl:text> <xsl:text> eventOut SFBool isOver&#10;</xsl:text> <xsl:text> eventOut SFTime touchTime&#10;</xsl:text> <xsl:text> eventOut SFString hitGeoCoord_changed&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoTouchSensor.wrl#GeoTouchSensor"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoTouchSensor.wrl#GeoTouchSensor"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoTouchSensor.wrl#GeoTouchSensor"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoTouchSensor.wrl#GeoTouchSensor"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="//GeoViewpoint and not(//ExternProtoDeclare[@name='GeoViewpoint']) and not(//ProtoDeclare[@name='GeoViewpoint'])"> <xsl:text>EXTERNPROTO GeoViewpoint [&#10;</xsl:text> <xsl:text> field SFNode geoOrigin # NULL&#10;</xsl:text> <xsl:text> field MFString geoSystem # ["GDC"]&#10;</xsl:text> <xsl:text> field SFString position # "0 0 100000"&#10;</xsl:text> <xsl:text> field SFRotation orientation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField SFFloat fieldOfView # 0.785398&#10;</xsl:text> <xsl:text> exposedField SFBool jump # TRUE&#10;</xsl:text> <xsl:text> exposedField MFString navType # ["EXAMINE","ANY"]&#10;</xsl:text> <xsl:text> exposedField SFBool headlight # TRUE&#10;</xsl:text> <xsl:text> field SFString description # ""&#10;</xsl:text> <xsl:text> field SFFloat speed # 1.0&#10;</xsl:text> <xsl:text> eventIn SFString set_position&#10;</xsl:text> <xsl:text> eventIn SFString set_orientation&#10;</xsl:text> <xsl:text> eventIn SFBool set_bind&#10;</xsl:text> <xsl:text> eventOut SFTime bindTime&#10;</xsl:text> <xsl:text> eventOut SFBool isBound&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "C:\Program Files\GeoVRML\1.0\protos\GeoViewpoint.wrl#GeoViewpoint"&#10;</xsl:text> <xsl:text> "file:
C|/Program Files/GeoVRML/1.0/protos/GeoViewpoint.wrl#GeoViewpoint"&#10;</xsl:text>

<xsl:text> "urn:web3d:geovrml:1.0/protos/GeoViewpoint.wrl#GeoViewpoint"&#10;</xsl:text> <xsl:text> "http://www.geovrml.org/1.0/protos/GeoViewpoint.wrl#GeoViewpoint"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <!-- ================================================================================================= --> <!-- Insert LatticeXvl EXTERNPROTO declarations, if not otherwise provided --> <xsl:if test="//XvlShell and not(//ExternProtoDeclare[@name='XvlShell']) and not(//ProtoDeclare[@name='XvlShell'])"> <![CDATA[ EXTERNPROTO XvlShell [ # nodeType IndexedFaceSet # Allowable children of XvlShell: a single Coordinate node (required for rendering) and a single TextureCoordinate node (optional) field SFInt32 shellType field SFInt32 numberOfDivisions field SFNode coord field SFNode texCoord field MFFloat vertexRound field MFInt32 edgeBeginCoordIndex field MFInt32 edgeEndCoordIndex field MFFloat edgeRound field MFVec3f edgeBeginVector field MFVec3f edgeEndVector field MFInt32 faceCoordIndex field MFInt32 faceTexCoordIndex field SFString faceEmpty # type Booleans field SFString faceHidden # type Booleans ][ "XvlShellProtoDeclare.wrl#XvlShell" "./XvlShellProtoDeclare.wrl#XvlShell" "C:\www.web3d.org\TaskGroups\x3d\translation\examples\LatticeXvl\XvlShellProtoDeclare.wrl#XvlShell" "/www.web3d.org/TaskGroups/x3d/translation/examples/LatticeXvl/XvlShellProtoDeclare.wrl#XvlShell" "http://www.web3d.org/TaskGroups/x3d/translation/examples/LatticeXvl/XvlShellProtoDeclare.wrl#XvlShell" ] ]]> </xsl:if> <!-- ================================================================================================= --> <!-- H-Anim Humanoid Animation h-anim.org/Specifications/H-Anim2001 --> <!-- standard www.web3D.org EXTERNPROTO URLs are not needed, since Prototype declarations work OK... these can be superceded by a browser, if desired. --> <xsl:if test="(//Displacer or //ProtoInstance[@name='Displacer']) and not(//ExternProtoDeclare[@name='Displacer']) and not(//ProtoDeclare[@name='Displacer'])"> <![CDATA[ PROTO Displacer [ exposedField SFString name "" exposedField MFInt32 coordIndex [ ] exposedField MFVec3f displacements [ ] ] { WorldInfo { info "null body node" } } ]]> </xsl:if> <xsl:if test="(//Humanoid or //ProtoInstance[@name='Humanoid']) and not(//ExternProtoDeclare[@name='Humanoid']) and not(//ProtoDeclare[@name='Humanoid'])"> <xsl:if test="(//Humanoid[@version='1.1'] or //Humanoid/humanoidBody) and (//Humanoid[@version='2.0'] or //Humanoid/skeleton or //Humanoid/skin or //Humanoid/skinCoord or //Humanoid/skinNormal)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>H-Anim 1.1 and 2.0 models can't be present in same file due to Humanoid Prototype differences</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> </xsl:if> <xsl:choose> <xsl:when test="//Humanoid[@version='1.1'] or //Humanoid/humanoidBody"> <xsl:text># PROTO version taken from H-Anim.org/Specifications/H-Anim1.1/#humanoid&;#10;</xsl:text> <xsl:text># EXTERNPROTO version also available via www.h-anim.org/Nodes/H-Anim1.1/Humanoid.wrl#Humanoid&;#10;</xsl:text> <![CDATA[ PROTO Humanoid [ exposedField SFString name "" exposedField SFString version "1.1" exposedField MFString info [ ] exposedField SFVec3f translation 0 0 0 exposedField SFRotation rotation 0 0 1 0 exposedField SFVec3f scale 1 1 1 exposedField SFRotation scaleOrientation 0 0 1 0 exposedField SFVec3f center 0 0 0 field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 exposedField MFNode humanoidBody [ ] exposedField MFNode joints [ ] exposedField MFNode segments [ ] exposedField MFNode sites [ ] exposedField MFNode viewpoints [ ] ] { Transform { translation IS translation rotation IS rotation center IS center scale IS scale scaleOrientation IS scaleOrientation bboxCenter IS bboxCenter bboxSize IS bboxSize children [ Group { children IS humanoidBody } Group { children IS viewpoints } ] } } ]]> </xsl:when> <xsl:otherwise> <xsl:text># PROTO version taken from www.h-anim.org/Models/H-Anim2001/boxman/boxman.wrl&;#10;</xsl:text> <xsl:text># EXTERNPROTO version will also be available at h-anim.org/Nodes &#10;</xsl:text> <![CDATA[ PROTO Humanoid [ exposedField SFString name "" exposedField SFString version "2.0" exposedField SFString humanoidVersion "" exposedField MFString info [ ] exposedField SFVec3f translation 0 0 0 exposedField SFRotation rotation 0 0 1 0 exposedField SFVec3f scale 1 1 1 exposedField SFRotation scaleOrientation 0 0 1 0 exposedField SFVec3f center 0 0 0 field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 exposedField MFNode skeleton [ ] exposedField MFNode skin [ ] exposedField MFNode joints [ ] exposedField MFNode segments [ ] exposedField MFNode sites [ ] exposedField MFNode viewpoints [ ] exposedField SFNode skinCoord NULL exposedField SFNode skinNormal NULL ] { Transform { translation IS translation rotation IS rotation scale IS scale scaleOrientation IS scaleOrientation center IS center bboxCenter IS bboxCenter bboxSize IS bboxSize children [ Group { children IS skeleton } Group { children IS skin } Group { children IS viewpoints } ] } } ]]> </xsl:otherwise> </xsl:choose> </xsl:if> <xsl:if test="(//Joint or //ProtoInstance[@name='Joint']) and not(//ExternProtoDeclare[@name='Joint']) and not(//ProtoDeclare[@name='Joint'])"> <![CDATA[ PROTO Joint [ exposedField SFString name "" exposedField MFFloat ulimit [ ] exposedField MFFloat llimit [ ] exposedField SFRotation limitOrientation 0 0 1 0 exposedField MFInt32 skinCoordIndex [ ] exposedField MFFloat skinCoordWeight [ ] exposedField MFFloat stiffness [ 0 0 0 ] exposedField SFVec3f translation 0 0 0 exposedField SFRotation rotation 0 0 1 0 exposedField SFVec3f scale 1 1 1 exposedField SFRotation scaleOrientation 0 0 1 0 exposedField SFVec3f center 0 0 0 field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 exposedField MFNode children [ ] eventIn MFNode addChildren eventIn MFNode removeChildren ] { Transform { translation IS translation rotation IS rotation scale IS scale scaleOrientation IS scaleOrientation center IS center bboxCenter IS bboxCenter bboxSize IS bboxSize children IS children addChildren IS addChildren removeChildren IS removeChildren } } ]]> </xsl:if> <xsl:if test="(//Segment or //ProtoInstance[@name='Segment']) and not(//ExternProtoDeclare[@name='Segment']) and not(//ProtoDeclare[@name='Segment'])"> <![CDATA[ PROTO Segment [ exposedField SFString name "" exposedField SFFloat mass 0 exposedField SFVec3f centerOfMass 0 0 0 exposedField MFFloat momentsOfInertia [ 0 0 0 0 0 0 0 0 0 ] field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 exposedField MFNode children [ ] eventIn MFNode addChildren eventIn MFNode removeChildren exposedField SFNode coord NULL exposedField MFNode displacers [ ] ] { Group { bboxCenter IS bboxCenter bboxSize IS bboxSize children IS children addChildren IS addChildren removeChildren IS removeChildren } } ]]> </xsl:if> <xsl:if test="(//Site or //ProtoInstance[@name='Site']) and not(//ExternProtoDeclare[@name='Site']) and not(//ProtoDeclare[@name='Site'])"> <![CDATA[ PROTO Site [ exposedField SFString name "" exposedField SFVec3f translation 0 0 0 exposedField SFRotation rotation 0 0 1 0 exposedField SFVec3f scale 1 1 1 exposedField SFRotation scaleOrientation 0 0 1 0 exposedField SFVec3f center 0 0 0 field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 exposedField MFNode children [] eventIn MFNode addChildren eventIn MFNode removeChildren ] { Transform { children IS children addChildren IS addChildren removeChildren IS removeChildren center IS center rotation IS rotation scale IS scale scaleOrientation IS scaleOrientation translation IS translation } } ]]> <![CDATA[ ]]> </xsl:if> <!-- <xsl:if test="(//Humanoid or //ProtoInstance[@name='Humanoid']) and not(//ExternProtoDeclare[@name='Humanoid']) and not(//ProtoDeclare[@name='Humanoid'])"> <xsl:text>EXTERNPROTO Humanoid [&#10;</xsl:text> <xsl:text> field SFVec3f bboxCenter # 0 0 0&#10;</xsl:text> <xsl:text> field SFVec3f bboxSize # -1 -1 -1&#10;</xsl:text> <xsl:text> exposedField SFVec3f center # 0 0 0&#10;</xsl:text> <xsl:text> exposedField MFNode humanoidBody # [ ]&#10;</xsl:text> <xsl:text> exposedField MFString info # [ ]&#10;</xsl:text> <xsl:text> exposedField MFNode joints # [ ]&#10;</xsl:text> <xsl:text> exposedField SFString name # ""&#10;</xsl:text> <xsl:text> exposedField SFRotation rotation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField SFVec3f scale # 1 1 1&#10;</xsl:text> <xsl:text> exposedField SFRotation scaleOrientation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField MFNode segments # [ ]&#10;</xsl:text> <xsl:text> exposedField MFNode sites # [ ]&#10;</xsl:text> <xsl:text> exposedField SFVec3f translation # 0 0 0&#10;</xsl:text> <xsl:text> exposedField SFString version # "1.1"&#10;</xsl:text> <xsl:text> exposedField MFNode viewpoints # [ ]&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "NancyProtos.wrl#Humanoid"&#10;</xsl:text> <xsl:text> "C:/www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Humanoid"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Humanoid"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="(//Displacer or //ProtoInstance[@name='Displacer']) and not(//ExternProtoDeclare[@name='Displacer']) and not(//ProtoDeclare[@name='Displacer'])"> <xsl:text>EXTERNPROTO Displacer [&#10;</xsl:text> <xsl:text> exposedField MFInt32 coordIndex # [ ]&#10;</xsl:text> <xsl:text> exposedField MFVec3f displacements # [ ]&#10;</xsl:text> <xsl:text> exposedField SFString name # ""&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "NancyProtos.wrl#Displacer"&#10;</xsl:text> <xsl:text> "C:/www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Displacer"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Displacer"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="(//Joint or //ProtoInstance[@name='Joint']) and not(//ExternProtoDeclare[@name='Joint']) and not(//ProtoDeclare[@name='Joint'])"> <xsl:text>EXTERNPROTO Joint [&#10;</xsl:text> <xsl:text> exposedField SFVec3f center # 0 0 0&#10;</xsl:text> <xsl:text> exposedField MFNode children # []&#10;</xsl:text> <xsl:text> exposedField MFFloat llimit # []&#10;</xsl:text> <xsl:text> exposedField SFRotation limitOrientation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField SFString name # ""&#10;</xsl:text> <xsl:text> exposedField SFRotation rotation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField SFVec3f scale # 1 1 1&#10;</xsl:text> <xsl:text> exposedField SFRotation scaleOrientation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField MFFloat stiffness # [ 0 0 0 ]&#10;</xsl:text> <xsl:text> exposedField SFVec3f translation # 0 0 0&#10;</xsl:text> <xsl:text> exposedField MFFloat ulimit # []&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "NancyProtos.wrl#Joint"&#10;</xsl:text> <xsl:text> "C:/www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Joint"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Joint"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="(//Segment or //ProtoInstance[@name='Segment']) and not(//ExternProtoDeclare[@name='Segment']) and not(//ProtoDeclare[@name='Segment'])"> <xsl:text>EXTERNPROTO Segment [&#10;</xsl:text> <xsl:text> field SFVec3f bboxCenter # 0 0 0&#10;</xsl:text> <xsl:text> field SFVec3f bboxSize # -1 -1 -1&#10;</xsl:text> <xsl:text> exposedField SFVec3f centerOfMass # 0 0 0&#10;</xsl:text> <xsl:text> exposedField MFNode children # [ ]&#10;</xsl:text> <xsl:text> exposedField SFNode coord # NULL&#10;</xsl:text> <xsl:text> exposedField MFNode displacers # [ ]&#10;</xsl:text> <xsl:text> exposedField SFFloat mass # 0 &#10;</xsl:text> <xsl:text> exposedField MFFloat momentsOfInertia # [ 0 0 0 0 0 0 0 0 0 ]&#10;</xsl:text> <xsl:text> exposedField SFString name # ""&#10;</xsl:text> <xsl:text> eventIn MFNode addChildren&#10;</xsl:text> <xsl:text> eventIn MFNode removeChildren&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "NancyProtos.wrl#Segment"&#10;</xsl:text> <xsl:text> "C:/www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Segment"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Segment"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> <xsl:if test="(//Site or //ProtoInstance[@name='Site']) and not(//ExternProtoDeclare[@name='Site']) and not(//ProtoDeclare[@name='Site'])"> <xsl:text>EXTERNPROTO Site [&#10;</xsl:text> <xsl:text> exposedField SFVec3f center # 0 0 0&#10;</xsl:text> <xsl:text> exposedField MFNode children # []&#10;</xsl:text> <xsl:text> exposedField SFString name # ""&#10;</xsl:text> <xsl:text> exposedField SFRotation rotation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField SFVec3f scale # 1 1 1&#10;</xsl:text> <xsl:text> exposedField SFRotation scaleOrientation # 0 0 1 0&#10;</xsl:text> <xsl:text> exposedField SFVec3f translation # 0 0 0&#10;</xsl:text> <xsl:text> eventIn MFNode addChildren &#10;</xsl:text> <xsl:text> eventIn MFNode removeChildren&#10;</xsl:text> <xsl:text>] [&#10;</xsl:text> <xsl:text> "NancyProtos.wrl#Site"&#10;</xsl:text> <xsl:text> "C:/www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Segment"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/TaskGroups/x3d/translation/examples/HumanoidAnimation/NancyProtos.wrl#Site"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> </xsl:if> --> <!-- ================================================================================================= --> <!-- DIS-Java-VRML www.web3D.org/WorkingGroups/vrtp/dis-java-vrml --> <xsl:if test="(//EspduTransform or //ProtoInstance[@name='EspduTransform']) and not(//ExternProtoDeclare[@name='EspduTransform'] or //ProtoDeclare[@name='EspduTransform'])"> <![CDATA[ EXTERNPROTO EspduTransform [ # nodeType Transform # [appInfo] EspduTransform is a networked Grouping node that can contain most nodes. EspduTransform integrates functionality for the following DIS PDUs: EntityStatePdu CollisionPdu DetonatePdu FirePdu CreateEntity RemoveEntity. # Entity identity field SFString marking # [appInfo] 0..11 character label for entity field SFInt32 siteID # [appInfo] EntityID: site field SFInt32 applicationID # [appInfo] EntityID: application ID, unique ID for app at that site field SFInt32 entityID # [appInfo] unique ID for entity within that app # Networking configuration parameters field SFString networkMode # [appInfo] remote | master | local [remote] eventOut SFBool isLocal eventOut SFBool isMaster eventOut SFBool isRemote field SFTime readInterval # [appInfo] seconds between read updates (if reading as remote) field SFTime writeInterval # [appInfo] seconds between write updates (if writing as master) field SFString address # [appInfo] multicast address, or else "localhost" listens to local defaultBridge field SFInt32 port # [appInfo] multicast port, or else listen to local defaultBridge field SFString multicastRelayHost field SFInt32 multicastRelayPort field SFBool rtpHeaderExpected eventOut SFBool rtpHeaderHeard # Standard VRML Transform fields exposedField MFNode children exposedField SFVec3f translation exposedField SFRotation rotation exposedField SFVec3f scale exposedField SFVec3f scaleOrientation exposedField SFVec3f center field SFVec3f bboxCenter field SFVec3f bboxSize eventIn MFNode addChildren eventIn MFNode removeChildren # Events: active, Collision/Fire PDU heard, or recent active ESPDUs heard eventOut SFTime timestamp # [appInfo] DIS timestamp in VRML units eventOut SFBool active # [appInfo] have we had an update recently? eventOut SFBool collided # [appInfo] has a CollisionPDU reported a collision? eventOut SFTime collideTime # [appInfo] when were we collided with? eventOut SFBool detonated # [appInfo] has a DetonationPDU reported a detonation? eventOut SFTime detonateTime # [appInfo] when were we detonated? eventOut SFBool fired1 # [appInfo] have we shot a Fire (weapon) PDU (primary)? eventOut SFBool fired2 # [appInfo] have we shot a Fire (weapon) PDU (secondary)? eventOut SFTime firedTime # [appInfo] when did we shoot a Fire (weapon) PDU? eventOut SFVec3f munitionStartPoint # [appInfo] exercise coordinates eventOut SFVec3f munitionEndPoint # [appInfo] exercise coordinates # Articulated Parameter (user-defined payload) fields eventOut SFInt32 articulationParameterCount # [appInfo] number of articulated parameters available eventOut SFFloat articulationParameterValue0 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue1 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue2 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue3 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue4 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue5 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue6 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue7 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue8 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue9 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue10 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue11 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue12 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue13 # [appInfo] user-defined payload value eventOut SFFloat articulationParameterValue14 # [appInfo] user-defined payload value # Trace fields exposedField SFColor traceColor # [appInfo] color of VRML trace text exposedField SFVec3f traceOffset # [appInfo] VRML text position relative to entity exposedField SFVec3f traceSize # [appInfo] VRML text scale field SFBool traceJava # [appInfo] Java console tracing enabled? ][ "EspduTransformPROTO.wrl#EspduTransform" "file:
C:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"

"file:
D:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"

"file:
C|/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"

"file:
D|/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"

"file:
vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"

"file://vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "C:\vrtp\mil\navy\nps\dis\EspduTransformPROTO.wrl#EspduTransform" "/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "../../../../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "c:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "d:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "e:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform" ] ]]> <!-- <xsl:text>EXTERNPROTO EspduTransform [&#10;</xsl:text> <xsl:text> eventOut SFTime timestamp # DIS timestamp in VRML units&#10;</xsl:text> <xsl:text> field SFString marking # 0..11 character label for entity&#10;</xsl:text> <xsl:text> field SFTime readInterval # seconds between read updates, 0 means no reading&#10;</xsl:text> <xsl:text> field SFTime writeInterval # seconds between write updates, 0 means no writing&#10;</xsl:text> <xsl:text> field SFString address # multicast address or "localhost"&#10;</xsl:text> <xsl:text> field SFInt32 port # port number&#10;</xsl:text> <xsl:text> field SFInt32 siteID # EntityID triplet, first element&#10;</xsl:text> <xsl:text> field SFInt32 applicationID # EntityID triplet, second element&#10;</xsl:text> <xsl:text> field SFInt32 entityID # EntityID triplet, third element&#10;</xsl:text> <xsl:text> &#10;</xsl:text> <xsl:text> # Standard VRML Transform fields - - - - - - - - - - - - - - - - - - - - - - - - -&#10;</xsl:text> <xsl:text> exposedField MFNode children&#10;</xsl:text> <xsl:text> exposedField SFVec3f translation # default prior to DIS update &#10;</xsl:text> <xsl:text> exposedField SFRotation rotation # default prior to DIS update&#10;</xsl:text> <xsl:text> exposedField SFVec3f scale&#10;</xsl:text> <xsl:text> exposedField SFRotation scaleOrientation&#10;</xsl:text> <xsl:text> field SFVec3f bboxCenter&#10;</xsl:text> <xsl:text> field SFVec3f bboxSize&#10;</xsl:text> <xsl:text> exposedField SFVec3f center&#10;</xsl:text> <xsl:text> eventIn MFNode addChildren&#10;</xsl:text> <xsl:text> eventIn MFNode removeChildren&#10;</xsl:text> <xsl:text> &#10;</xsl:text> <xsl:text> # Automatic MulticastRelayClient if no multicast heard - - - - - - - - - - - - - -&#10;</xsl:text> <xsl:text> field SFString multicastRelayHost&#10;</xsl:text> <xsl:text> field SFInt32 multicastRelayPort&#10;</xsl:text> <xsl:text> field SFBool rtpHeaderExpected # whether RTP headers are prepended to DIS&#10;</xsl:text> <xsl:text> eventOut SFBool rtpHeaderHeard&#10;</xsl:text> <xsl:text> &#10;</xsl:text> <xsl:text> # Collision/Detonation/Fire PDU heard, or no active ESPDUs heard - - - - - - - - -&#10;</xsl:text> <xsl:text> eventOut SFBool active # have we had an update recently?&#10;</xsl:text> <xsl:text> eventOut SFBool collided # has a CollisionPDU reported a collision?&#10;</xsl:text> <xsl:text> eventOut SFTime collideTime # when were we collided with?&#10;</xsl:text> <xsl:text> eventOut SFBool detonated # has a DetonationPDU reported a detonation?&#10;</xsl:text> <xsl:text> eventOut SFTime detonateTime # when were we detonated?&#10;</xsl:text> <xsl:text> eventOut SFBool fired1 # have we shot a Fire (weapon) PDU (primary)?&#10;</xsl:text> <xsl:text> eventOut SFBool fired2 # have we shot a Fire (weapon) PDU (secondary)?&#10;</xsl:text> <xsl:text> eventOut SFTime firedTime # when did we shoot a Fire (weapon) PDU?&#10;</xsl:text> <xsl:text> eventOut SFVec3f munitionStartPoint # exercise coordinates&#10;</xsl:text> <xsl:text> eventOut SFVec3f munitionEndPoint # exercise coordinates&#10;</xsl:text> <xsl:text> &#10;</xsl:text> <xsl:text> # Articulated Parameter (user-defined payload) fields - - - - - - - - - - - - - - - - - - - - - -&#10;</xsl:text> <xsl:text> eventOut SFInt32 articulationParameterCount # articulated parameters available&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue0 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue1 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue2 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue3 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue4 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue5 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue6 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue7 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue8 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue9 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue10 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue11 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue12 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue13 # user-defined payload value&#10;</xsl:text> <xsl:text> eventOut SFFloat articulationParameterValue14 # user-defined payload value&#10;</xsl:text> <xsl:text> &#10;</xsl:text> <xsl:text> # Trace fields - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&#10;</xsl:text> <xsl:text> exposedField SFColor traceColor # color of VRML trace text&#10;</xsl:text> <xsl:text> exposedField SFVec3f traceOffset # VRML text position relative to entity&#10;</xsl:text> <xsl:text> exposedField SFVec3f traceSize # VRML text scale&#10;</xsl:text> <xsl:text> field SFBool traceJava # Java console tracing enabled?&#10;</xsl:text> <xsl:text> &#10;</xsl:text> <xsl:text> ] [#"EspduTransformPROTO.wrl#EspduTransform" # local or remote URLs for the EXTERNPROTO&#10;</xsl:text> <xsl:text> "file:
C:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text>

<xsl:text> "file:
D:/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text>

<xsl:text> "file:
C|/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text>

<xsl:text> "file:
D|/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text>

<xsl:text> "file:
vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text>

<xsl:text> "file://vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "C:\vrtp\mil\navy\nps\dis\EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "/vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> "../../../../../../../../../../vrtp/mil/navy/nps/dis/EspduTransformPROTO.wrl#EspduTransform"&#10;</xsl:text> <xsl:text> ]&#10;</xsl:text> --> </xsl:if> <xsl:if test="(//ReceiverPdu or //ProtoInstance[@name='ReceiverPdu']) and not(//ExternProtoDeclare[@name='ReceiverPdu'] or //ProtoDeclare[@name='ReceiverPdu'])"> <xsl:text>EXTERNPROTO ReceiverPdu [&#10;</xsl:text> <xsl:text> # nodeType Switch&#10;</xsl:text> <xsl:text> # set whichGeometry to -1 for no geometry, 0 for text trace, 1 for default geometry&#10;</xsl:text> <xsl:text> exposedField SFInt32 whichGeometry&#10;</xsl:text> <xsl:text> # Initialization fields&#10;</xsl:text> <xsl:text> field SFTime readInterval&#10;</xsl:text> <xsl:text> field SFTime writeInterval&#10;</xsl:text> <xsl:text> field SFInt32 siteID&#10;</xsl:text> <xsl:text> field SFInt32 applicationID&#10;</xsl:text> <xsl:text> field SFInt32 entityID&#10;</xsl:text> <xsl:text> field SFString address&#10;</xsl:text> <xsl:text> field SFInt32 port&#10;</xsl:text> <xsl:text> field SFString multicastRelayHost&#10;</xsl:text> <xsl:text> field SFInt32 multicastRelayPort&#10;</xsl:text> <xsl:text> field SFBool rtpHeaderExpected&#10;</xsl:text> <xsl:text> field SFBool traceJava&#10;</xsl:text> <xsl:text> # Generic events&#10;</xsl:text> <xsl:text> eventOut SFBool active&#10;</xsl:text> <xsl:text> eventOut SFTime timestamp&#10;</xsl:text> <xsl:text> eventOut SFBool rtpHeaderHeard&#10;</xsl:text> <xsl:text> # RadioCommunicationsFamily events&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioID&#10;</xsl:text> <xsl:text> # ReceiverPdu fields&#10;</xsl:text> <xsl:text> eventOut SFFloat receiverPower&#10;</xsl:text> <xsl:text> eventOut SFInt32 receiverState&#10;</xsl:text> <xsl:text> eventOut SFInt32 transmitterSiteID&#10;</xsl:text> <xsl:text> eventOut SFInt32 transmitterApplicationID&#10;</xsl:text> <xsl:text> eventOut SFInt32 transmitterEntityID&#10;</xsl:text> <xsl:text> eventOut SFInt32 transmitterRadioID&#10;</xsl:text> <xsl:text>][&#10;</xsl:text> <xsl:text> "RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "RadioCommunicationsPrototypes.xml#ReceiverPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.xml#ReceiverPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.xml#ReceiverPdu"&#10;</xsl:text> <xsl:text> "file:
C:/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text>

<xsl:text> "file:
D:/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text>

<xsl:text> "file:
C|/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text>

<xsl:text> "file:
D|/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text>

<xsl:text> "file:
vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text>

<xsl:text> "file://vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "C:\vrtp\mil\navy\nps\dis\RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#ReceiverPdu"&#10;</xsl:text> <xsl:text>]&#10;</xsl:text> </xsl:if> <xsl:if test="(//SignalPdu or //ProtoInstance[@name='SignalPdu']) and not(//ExternProtoDeclare[@name='SignalPdu'] or //ProtoDeclare[@name='SignalPdu'])"> <xsl:text>EXTERNPROTO SignalPdu [&#10;</xsl:text> <xsl:text> # nodeType Switch&#10;</xsl:text> <xsl:text> # set whichGeometry to -1 for no geometry, 0 for text trace, 1 for default geometry&#10;</xsl:text> <xsl:text> exposedField SFInt32 whichGeometry&#10;</xsl:text> <xsl:text> # Initialization fields&#10;</xsl:text> <xsl:text> field SFTime readInterval&#10;</xsl:text> <xsl:text> field SFTime writeInterval&#10;</xsl:text> <xsl:text> field SFInt32 siteID&#10;</xsl:text> <xsl:text> field SFInt32 applicationID&#10;</xsl:text> <xsl:text> field SFInt32 entityID&#10;</xsl:text> <xsl:text> field SFString address&#10;</xsl:text> <xsl:text> field SFInt32 port&#10;</xsl:text> <xsl:text> field SFString multicastRelayHost&#10;</xsl:text> <xsl:text> field SFInt32 multicastRelayPort&#10;</xsl:text> <xsl:text> field SFBool rtpHeaderExpected&#10;</xsl:text> <xsl:text> field SFBool traceJava&#10;</xsl:text> <xsl:text> # Generic events&#10;</xsl:text> <xsl:text> eventOut SFBool active&#10;</xsl:text> <xsl:text> eventOut SFTime timestamp&#10;</xsl:text> <xsl:text> eventOut SFBool rtpHeaderHeard&#10;</xsl:text> <xsl:text> # RadioCommunicationsFamily events&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioID&#10;</xsl:text> <xsl:text> # SignalPdu fields&#10;</xsl:text> <xsl:text> eventOut SFInt32 encodingScheme&#10;</xsl:text> <xsl:text> eventOut SFInt32 tdlType&#10;</xsl:text> <xsl:text> eventOut SFInt32 sampleRate&#10;</xsl:text> <xsl:text> eventOut SFInt32 samples&#10;</xsl:text> <xsl:text> eventOut SFInt32 dataLength&#10;</xsl:text> <xsl:text> eventOut SFInt32 data00&#10;</xsl:text> <xsl:text> eventOut SFInt32 data01&#10;</xsl:text> <xsl:text> eventOut SFInt32 data02&#10;</xsl:text> <xsl:text> eventOut SFInt32 data03&#10;</xsl:text> <xsl:text> eventOut SFInt32 data04&#10;</xsl:text> <xsl:text> eventOut SFInt32 data05&#10;</xsl:text> <xsl:text> eventOut SFInt32 data06&#10;</xsl:text> <xsl:text> eventOut SFInt32 data07&#10;</xsl:text> <xsl:text> eventOut SFInt32 data08&#10;</xsl:text> <xsl:text> eventOut SFInt32 data09&#10;</xsl:text> <xsl:text> eventOut SFInt32 data10&#10;</xsl:text> <xsl:text>][&#10;</xsl:text> <xsl:text> "RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "RadioCommunicationsPrototypes.xml#SignalPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.xml#SignalPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.xml#SignalPdu"&#10;</xsl:text> <xsl:text> "file:
C:/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text>

<xsl:text> "file:
D:/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text>

<xsl:text> "file:
C|/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text>

<xsl:text> "file:
D|/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text>

<xsl:text> "file:
vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text>

<xsl:text> "file://vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "C:\vrtp\mil\navy\nps\dis\RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#SignalPdu"&#10;</xsl:text> <xsl:text>]&#10;</xsl:text> </xsl:if> <xsl:if test="(//TransmitterPdu or //ProtoInstance[@name='TransmitterPdu']) and not(//ExternProtoDeclare[@name='TransmitterPdu'] or //ProtoDeclare[@name='TransmitterPdu'])"> <xsl:text>EXTERNPROTO TransmitterPdu [&#10;</xsl:text> <xsl:text> # nodeType Switch&#10;</xsl:text> <xsl:text> # set whichGeometry to -1 for no geometry, 0 for text trace, 1 for default geometry&#10;</xsl:text> <xsl:text> exposedField SFInt32 whichGeometry&#10;</xsl:text> <xsl:text> # Initialization fields&#10;</xsl:text> <xsl:text> field SFTime readInterval&#10;</xsl:text> <xsl:text> field SFTime writeInterval&#10;</xsl:text> <xsl:text> field SFInt32 siteID&#10;</xsl:text> <xsl:text> field SFInt32 applicationID&#10;</xsl:text> <xsl:text> field SFInt32 entityID&#10;</xsl:text> <xsl:text> field SFString address&#10;</xsl:text> <xsl:text> field SFInt32 port&#10;</xsl:text> <xsl:text> field SFString multicastRelayHost&#10;</xsl:text> <xsl:text> field SFInt32 multicastRelayPort&#10;</xsl:text> <xsl:text> field SFBool rtpHeaderExpected&#10;</xsl:text> <xsl:text> field SFBool traceJava&#10;</xsl:text> <xsl:text> # Generic events&#10;</xsl:text> <xsl:text> eventOut SFBool active&#10;</xsl:text> <xsl:text> eventOut SFTime timestamp&#10;</xsl:text> <xsl:text> eventOut SFBool rtpHeaderHeard&#10;</xsl:text> <xsl:text> # RadioCommunicationsFamily events&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioID&#10;</xsl:text> <xsl:text> # TransmitterPdu fields&#10;</xsl:text> <xsl:text> eventOut SFVec3f antennaLocation&#10;</xsl:text> <xsl:text> eventOut SFInt32 antennaPatternLength&#10;</xsl:text> <xsl:text> eventOut SFInt32 antennaPatternType&#10;</xsl:text> <xsl:text> eventOut SFInt32 cryptoKeyId&#10;</xsl:text> <xsl:text> eventOut SFInt32 cryptoSytem&#10;</xsl:text> <xsl:text> eventOut SFInt32 frequency&#10;</xsl:text> <xsl:text> eventOut SFInt32 lengthOfModulationParameters&#10;</xsl:text> <xsl:text> eventOut SFInt32 modulationTypeDetail&#10;</xsl:text> <xsl:text> eventOut SFInt32 modulationTypeMajor&#10;</xsl:text> <xsl:text> eventOut SFInt32 modulationTypeSpreadSpectrum&#10;</xsl:text> <xsl:text> eventOut SFInt32 modulationTypeSystem&#10;</xsl:text> <xsl:text> eventOut SFInt32 power&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioEntityTypeCategory&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioEntityTypeCountry&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioEntityTypeDomain&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioEntityTypeKind&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioEntityTypeNomenclature&#10;</xsl:text> <xsl:text> eventOut SFInt32 radioEntityTypeNomenclatureVersion&#10;</xsl:text> <xsl:text> eventOut SFVec3f relativeAntennaLocation&#10;</xsl:text> <xsl:text> eventOut SFInt32 transmitFrequencyBandwidth&#10;</xsl:text> <xsl:text> eventOut SFInt32 transmitState&#10;</xsl:text> <xsl:text>][&#10;</xsl:text> <xsl:text> "RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "RadioCommunicationsPrototypes.xml#TransmitterPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.xml#TransmitterPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.xml#TransmitterPdu"&#10;</xsl:text> <xsl:text> "file:
C:/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text>

<xsl:text> "file:
D:/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text>

<xsl:text> "file:
C|/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text>

<xsl:text> "file:
D|/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text>

<xsl:text> "file:
vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text>

<xsl:text> "file://vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "http://web.nps.navy.mil/~brutzman/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "http://www.web3D.org/WorkingGroups/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "C:\vrtp\mil\navy\nps\dis\RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "/vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text> "../../../../../../../../../../vrtp/mil/navy/nps/dis/RadioCommunicationsPrototypes.wrl#TransmitterPdu"&#10;</xsl:text> <xsl:text>]&#10;</xsl:text> </xsl:if> <!-- continue with rest of scene, now that header and profile EXTERNPROTOs complete --> <xsl:apply-templates select="X3D/Scene"/> </xsl:template> <!-- ****** X3D: convert the X3D tag to VRML 3.0 header, recurse ****** --> <xsl:template match="X3D"> <xsl:text># [X3D] VRML V</xsl:text> <xsl:choose> <xsl:when test="@version"></xsl:when> <xsl:otherwise><xsl:text>3.0</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text> utf8&#10;</xsl:text> <xsl:if test="@profile"> <xsl:text>#VRML profile=</xsl:text><xsl:value-of select="@profile"/> <xsl:text>&#10;</xsl:text> </xsl:if> </xsl:template> <!-- ****** component: comment the component tag, recurse ****** --> <xsl:template match="component"> <xsl:text>#VRML component=</xsl:text> <xsl:value-of select="@name"/> <xsl:if test="@level">:</xsl:if> <xsl:text>&#10;</xsl:text> <xsl:apply-templates/> </xsl:template> <!-- ****** head: comment the head tag, recurse ****** --> <xsl:template match="head"> <xsl:text># [head]</xsl:text> <xsl:text>&#10;</xsl:text> <xsl:apply-templates/> </xsl:template> <!-- ****** meta: comment the meta tag's name and content ****** --> <xsl:template match="meta"> <xsl:text># [meta] </xsl:text> <xsl:value-of select="@name"/> <xsl:text>: </xsl:text> <!-- having trouble translating line breaks properly, changing them to spaces (which avoids runtime errors, at least). also comment tag. --> <xsl:value-of select="translate(@content,' ',' ')"/> <xsl:text>&#10;</xsl:text> </xsl:template> <!-- ****** Scene: comment the Scene tag, recurse ****** --> <xsl:template match="Scene"><xsl:text># [Scene]&#10;&#10;</xsl:text> <xsl:apply-templates> <xsl:with-param name="indent"><xsl:text>0</xsl:text></xsl:with-param> </xsl:apply-templates> </xsl:template> <!-- ****** recurse through each of the tree node elements, including ProtoInstance ****** --> <xsl:template match="*"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>
&#10;</xsl:text> -->

<xsl:call-template name="print-indent"></xsl:call-template> <!-- figure out node type for ProtoDeclared ProtoInstance, ExternProtoDeclared ProtoInstance and internal DTD declaration tag definitions --> <xsl:variable name="nodeName" select="./@name" /> <xsl:variable name="nodeName2" select="local-name()" /> <xsl:variable name="parentNodeName" select="../@name" /> <xsl:variable name="parentNodeName2" select="local-name(..)" /> <!-- ProtoDeclared ProtoInstance --> <xsl:variable name="nodeType" select="local-name(//ProtoDeclare[@name=nodeName or @name=nodeName2]/*[local-name()!='field'])" /> <xsl:variable name="parentType" select="local-name(//ProtoDeclare[@name=parentNodeName]/*[local-name()!='field'])" /> <!-- ExternProtoDeclared ProtoInstance --> <xsl:variable name="EPnodeType" select="//ExternProtoDeclare[@name=nodeName or @name=nodeName2]/@nodeType" /> <xsl:variable name="EPparentType" select="//ExternProtoDeclare[@name=parentNodeName]/@nodeType" /> <!-- debug diagnosis statements --> <!-- <xsl:text># parentNodeName </xsl:text><xsl:value-of select="parentNodeName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># parentNodeName2 </xsl:text><xsl:value-of select="parentNodeName2"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeName </xsl:text><xsl:value-of select="nodeName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeName2 </xsl:text><xsl:value-of select="nodeName2"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:if test="nodeName"># nodeName <xsl:text>&#10;</xsl:text></xsl:if> --> <!-- <xsl:text># local-name() </xsl:text><xsl:value-of select="local-name()"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeType </xsl:text><xsl:value-of select="nodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># parentType </xsl:text><xsl:value-of select="parentType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPnodeType </xsl:text><xsl:value-of select="EPnodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPparentType </xsl:text><xsl:value-of select="EPparentType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># @nodeType </xsl:text><xsl:value-of select="@nodeType"/><xsl:text>&#10;</xsl:text> --> <!-- if this is a non-(PROTO/field/fieldValue) child node, first output appropriate VRML 97 'field' name --> <xsl:if test="(local-name(..)!='Scene' and local-name(..)!='ProtoDeclare' and local-name(..)!='field' and local-name(..)!='fieldValue')"> <xsl:choose> <!-- 4-way node-type tests: native VRML node, ProtoDeclared ProtoInstance, ExternProtoDeclared ProtoInstance, or internal DTD declaration by content --> <xsl:when test="local-name()='Appearance' or nodeType='Appearance' or EPnodeType='Appearance' or @nodeType='Appearance' "><xsl:text>appearance </xsl:text></xsl:when> <xsl:when test="local-name()='AudioClip' or nodeType='AudioClip' or EPnodeType='AudioClip' or @nodeType='AudioClip' "><xsl:text>source </xsl:text></xsl:when> <xsl:when test="local-name()='Box' or nodeType='Box' or EPnodeType='Box' or @nodeType='Box' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='Color' or nodeType='Color' or EPnodeType='Color' or @nodeType='Color' "><xsl:text>color </xsl:text></xsl:when> <xsl:when test="local-name()='ColorNode' or nodeType='ColorNode' or EPnodeType='ColorNode' or @nodeType='ColorNode' "><xsl:text>color </xsl:text></xsl:when> <xsl:when test="((local-name()='Coordinate' or nodeType='Coordinate' or EPnodeType='Coordinate' or @nodeType='Coordinate') and not(local-name(..)='skinCoord')) or local-name()='GeoCoordinate' or nodeType='GeoCoordinate' or EPnodeType='GeoCoordinate' or @nodeType='GeoCoordinate' "><xsl:text>coord </xsl:text></xsl:when> <xsl:when test="local-name()='Cone' or nodeType='Cone' or EPnodeType='Cone' or @nodeType='Cone' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='Cylinder' or nodeType='Cylinder' or EPnodeType='Cylinder' or @nodeType='Cylinder' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='ElevationGrid' or nodeType='ElevationGrid' or EPnodeType='ElevationGrid' or @nodeType='ElevationGrid' or local-name()='GeoElevationGrid' or nodeType='GeoElevationGrid' or EPnodeType='GeoElevationGrid' or @nodeType='GeoElevationGrid' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='Extrusion' or nodeType='Extrusion' or EPnodeType='Extrusion' or @nodeType='Extrusion' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='FontStyle' or nodeType='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle' "><xsl:text>fontStyle </xsl:text></xsl:when> <xsl:when test="local-name()='ImageTexture' or nodeType='ImageTexture' or EPnodeType='ImageTexture' or @nodeType='ImageTexture' "><xsl:text>texture </xsl:text></xsl:when> <xsl:when test="local-name()='IndexedFaceSet' or nodeType='IndexedFaceSet' or EPnodeType='IndexedFaceSet' or @nodeType='IndexedFaceSet' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='IndexedLineSet' or nodeType='IndexedLineSet' or EPnodeType='IndexedLineSet' or @nodeType='IndexedLineSet' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='Material' or nodeType='Material' or EPnodeType='Material' or @nodeType='Material' "><xsl:text>material </xsl:text></xsl:when> <xsl:when test="(local-name()='MovieTexture' or nodeType='MovieTexture' or EPnodeType='MovieTexture' or @nodeType='MovieTexture') and (local-name(..)='Appearance' or parentType='Appearance' or EPparentType='Appearance' or ../@nodeType='Appearance' or local-name(..)='texture') "><xsl:text>texture </xsl:text></xsl:when> <xsl:when test="(local-name()='MovieTexture' or nodeType='MovieTexture' or EPnodeType='MovieTexture' or @nodeType='MovieTexture') and (local-name(..)='Sound' or parentType='Sound' or EPparentType='Sound' or ../@nodeType='Sound' or local-name(..)='source') "><xsl:text>source </xsl:text></xsl:when> <xsl:when test="((local-name()='Normal' or nodeType='Normal' or EPnodeType='Normal' or @nodeType='Normal') and not(local-name(..)='skinNormal'))"><xsl:text>normal </xsl:text></xsl:when> <xsl:when test="local-name()='PixelTexture' or nodeType='PixelTexture' or EPnodeType='PixelTexture' or @nodeType='PixelTexture' "><xsl:text>texture </xsl:text></xsl:when> <xsl:when test="local-name()='PointSet' or nodeType='PointSet' or EPnodeType='PointSet' or @nodeType='PointSet' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='Sphere' or nodeType='Sphere' or EPnodeType='Sphere' or @nodeType='Sphere' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='Text' or nodeType='Text' or EPnodeType='Text' or @nodeType='Text' "><xsl:text>geometry </xsl:text></xsl:when> <xsl:when test="local-name()='TextureCoordinate' or nodeType='TextureCoordinate' or EPnodeType='TextureCoordinate' or @nodeType='TextureCoordinate'"><xsl:text>texCoord </xsl:text></xsl:when> <xsl:when test="local-name()='TextureTransform' or nodeType='TextureTransform' or EPnodeType='TextureTransform' or @nodeType='TextureTransform' "><xsl:text>textureTransform </xsl:text></xsl:when> <xsl:when test="local-name()='XvlShell' or nodeType='XvlShell' or EPnodeType='XvlShell' or @nodeType='XvlShell' "><xsl:text>geometry </xsl:text></xsl:when> <!-- regular VRML nodes not needing a preceding field name --> <!-- (split following test to avoid overflowing lotusxml/Xalan string buffer) --> <xsl:when test=" contains(local-name(), 'Interpolator') or contains(nodeType, 'Interpolator') or contains(EPnodeType, 'Interpolator') or contains(@nodeType, 'Interpolator') or contains(local-name(), 'Light') or contains(nodeType, 'Light') or contains(EPnodeType, 'Light') or contains(@nodeType, 'Light') or contains(local-name(), 'Sensor') or contains(nodeType, 'Sensor') or contains(EPnodeType, 'Sensor') or contains(@nodeType, 'Sensor') or local-name()='NavigationInfo' or nodeType='NavigationInfo' or EPnodeType='NavigationInfo' or @nodeType='NavigationInfo' or local-name()='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor' or local-name()='Background' or nodeType='Background' or EPnodeType='Background' or @nodeType='Background' or local-name()='Billboard' or nodeType='Billboard' or EPnodeType='Billboard' or @nodeType='Billboard' or local-name()='Collision' or nodeType='Collision' or EPnodeType='Collision' or @nodeType='Collision' or local-name()='Fog' or nodeType='Fog' or EPnodeType='Fog' or @nodeType='Fog' or local-name()='Group' or nodeType='Group' or EPnodeType='Group' or @nodeType='Group' or local-name()='Inline' or nodeType='Inline' or EPnodeType='Inline' or @nodeType='Inline'"> <!-- appears to be a valid node, no warning required --></xsl:when> <xsl:when test=" local-name()='LOD' or nodeType='LOD' or EPnodeType='LOD' or @nodeType='LOD' or local-name()='proxy' or nodeType='proxy' or EPnodeType='proxy' or @nodeType='proxy' or local-name()='Transform' or nodeType='Transform' or EPnodeType='Transform' or @nodeType='Transform' or local-name()='Script' or nodeType='Script' or EPnodeType='Script' or @nodeType='Script' or local-name()='Shape' or nodeType='Shape' or EPnodeType='Shape' or @nodeType='Shape' or local-name()='Sound' or nodeType='Sound' or EPnodeType='Sound' or @nodeType='Sound' or local-name()='Switch' or nodeType='Switch' or EPnodeType='Switch' or @nodeType='Switch' or local-name()='Viewpoint' or nodeType='Viewpoint' or EPnodeType='Viewpoint' or @nodeType='Viewpoint' or local-name()='WorldInfo' or nodeType='WorldInfo' or EPnodeType='WorldInfo' or @nodeType='WorldInfo'"> <!-- appears to be a valid node, no warning required --></xsl:when> <xsl:when test=" local-name()='Displacer' or nodeType='Displacer' or EPnodeType='Displacer' or @nodeType='Displacer' or local-name()='Humanoid' or nodeType='Humanoid' or EPnodeType='Humanoid' or @nodeType='Humanoid' or local-name()='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint' or local-name()='Segment' or nodeType='Segment' or EPnodeType='Segment' or @nodeType='Segment' or local-name()='Site' or nodeType='Site' or EPnodeType='Site' or @nodeType='Site' or local-name()='EspduTransform' or nodeType='EspduTransform' or EPnodeType='EspduTransform' or @nodeType='EspduTransform' or local-name()='ReceiverPdu' or nodeType='ReceiverPdu' or EPnodeType='ReceiverPdu' or @nodeType='ReceiverPdu' or local-name()='SignalPdu' or nodeType='SignalPdu' or EPnodeType='SignalPdu' or @nodeType='SignalPdu' or local-name()='TransmitterPdu' or nodeType='TransmitterPdu' or EPnodeType='TransmitterPdu' or @nodeType='TransmitterPdu'"> <!-- appears to be a valid node, no warning required --></xsl:when> <xsl:when test="nodeType"> <!-- appears to be a valid prototype or native tag node, output nodeType as field name --> <!-- <xsl:text># nodeType&#10;</xsl:text> --> <xsl:value-of select="nodeType"/><xsl:text> </xsl:text> </xsl:when> <xsl:when test="EPnodeType"> <!-- appears to be a valid prototype or native tag node, output nodeType as field name --> <!-- <xsl:text># EPnodeType&#10;</xsl:text> --> <xsl:value-of select="EPnodeType"/><xsl:text> </xsl:text> </xsl:when> <!-- bug in Xeena's XSL parser doesn't see @nodeType, add explicit checks for GeoSpatial subnodes --> <xsl:when test="local-name()='GeoOrigin'"> <xsl:text>geoOrigin </xsl:text> </xsl:when> <xsl:when test="local-name(..)='GeoLOD' and local-name()='rootNode'"> <!-- no need to print rootNode out, just caught to avoid printing a warning --> </xsl:when> <xsl:when test="local-name(..)='Humanoid' and (local-name()='humanoidBody' or local-name()='skeleton')"> <!-- no need to print humanoidBody out, just caught to avoid printing a warning --> </xsl:when> <xsl:when test="((local-name()='Coordinate' or nodeType='Coordinate' or EPnodeType='Coordinate' or @nodeType='Coordinate') and (local-name(..)='skinCoord')) or ((local-name()='Normal' or nodeType='Normal' or EPnodeType='Normal' or @nodeType='Normal') and not(local-name(..)='skinNormal')) or local-name()='skinCoord' or local-name()='skinNormal'"> <!-- appears to be a valid node, no warning required --></xsl:when> <xsl:when test="@nodeType"> <!-- appears to be a valid prototype or native tag node, output nodeType as field name --> <!-- <xsl:text># @nodeType&#10;</xsl:text> --> <xsl:value-of select="@nodeType"/><xsl:text> </xsl:text> </xsl:when> <xsl:when test="local-name(.)='USE'"> <!-- no action, better checks would be helpful here --> </xsl:when> <!-- otherwise report likely error condition on this EXTERNPROTO / internal-declaration node as pseudo fieldname --> <xsl:otherwise> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>nodeType unknown for </xsl:text> <xsl:value-of select="local-name()"/> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:if> <!-- DEF node name --> <xsl:if test="@DEF">DEF <xsl:text> </xsl:text></xsl:if> <!-- output node name itself: ensure not proxy; then output USE, or ProtoInstance name, or actual node name --> <xsl:choose> <xsl:when test="local-name()='proxy'"><!-- ignore, handled a few steps down --></xsl:when> <xsl:when test="(local-name()='USE' and @node)"> <!-- don't forget the bloody wrapper tags! children handled separately. this section will need to be generalized for compact tagset form, or else have USE preclude wrapper-tag ignoring. --> <xsl:if test="local-name(..)='appearance' or local-name(..)='choice' or local-name(..)='color' or local-name(..)='coord' or local-name(..)='fontStyle' or local-name(..)='geometry' or local-name(..)='level' or local-name(..)='material' or local-name(..)='normal' or local-name(..)='source' or local-name(..)='texCoord' or local-name(..)='texture' or local-name(..)='textureTransform' or local-name(..)='sites'"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:value-of select="local-name(..)"/><xsl:text> </xsl:text><!-- output wrapper tag (except for children tag) --> </xsl:if> <xsl:text>USE </xsl:text><xsl:value-of select="@node"/> <xsl:text>&#10;</xsl:text> </xsl:when> <xsl:when test="(local-name()='USE')"> <xsl:text>USE __??__</xsl:text> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>node=&quot;DEFname&quot; not provided for USE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:when> <xsl:when test="@USE and *"> <xsl:text>USE </xsl:text><xsl:value-of select="@USE"/> <xsl:text> # XSL-translation error: no embedded node content allowed inside USE&#10;</xsl:text> </xsl:when> <xsl:when test="@USE"> <xsl:text>USE </xsl:text> <xsl:value-of select="@USE"/> <xsl:text>&#10;</xsl:text> </xsl:when> <xsl:when test="local-name()='ProtoInstance'"> <xsl:value-of select="@name"/> <xsl:text> {&#10;</xsl:text> </xsl:when> <xsl:when test="local-name()='ColorNode'"> <xsl:text>Color {&#10;</xsl:text> </xsl:when> <!-- handle MFNode fields in supported profiles --> <xsl:when test="(local-name(..)='GeoLOD' and local-name()='rootNode') or (local-name(..)='Segment' and local-name()='displacers') or (local-name(..)='Humanoid' and ((local-name()='humanoidBody' or local-name()='skeleton')))"> <xsl:value-of select="local-name()"/> <xsl:choose> <xsl:when test="*"> <xsl:text> [&#10;</xsl:text> <!-- # MFNode fields --> </xsl:when> <xsl:otherwise> <xsl:text> NULL&#10;</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of IS attribute definitions for SFNode/MFNode-type field declarations inside ProtoDeclarations --> <xsl:when test="@DEF and ancestor::*[local-name()='ProtoDeclare'] and not(local-name()='ProtoDeclare')"> <xsl:value-of select="local-name ()"/> <xsl:text> {&#10;</xsl:text> <!-- pattern-match variables --> <xsl:variable name="DEFname" select="@DEF" /> <!-- <xsl:variable name="fieldName" select="local-name()" /> --> <!-- <xsl:variable name="matchName" select="concat(@DEF,'.',local-name())" /> --> <!-- <xsl:text> # DEFname </xsl:text><xsl:value-of select="DEFname"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # fieldName </xsl:text><xsl:value-of select="fieldName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # matchName </xsl:text><xsl:value-of select="matchName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # ancestor PROTO field </xsl:text><xsl:value-of select="local-name(ancestor::*[local-name()='ProtoDeclare'])"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # ProtoDeclare ancestor &quot;</xsl:text><xsl:value-of select="ancestor::*[local-name()='ProtoDeclare']/@name"/><xsl:text>&quot; found&#10;</xsl:text> --> <xsl:if test="local-name()!='Script'"> <xsl:for-each select="ancestor::*[local-name()='ProtoDeclare']/field"> <!-- <xsl:text> # node rule: @IS </xsl:text><xsl:value-of select="@IS"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # (starts-with(@IS,concat(DEFname, '.')) </xsl:text><xsl:value-of select="starts-with(@IS,concat(DEFname, '.'))"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # concat(DEFname, '.') </xsl:text><xsl:value-of select="concat(DEFname, '.')"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # @type </xsl:text><xsl:value-of select="@type"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # substring-after(@IS,'.') </xsl:text><xsl:value-of select="substring-after(@IS,'.')"/><xsl:text>&#10;</xsl:text> --> <xsl:if test="starts-with(@IS,concat(DEFname, '.')) or contains(@IS,concat(' ',DEFname, '.'))"> <!-- this choose rule seems to work when extracting appropriate substring when multiple IS references occur... --> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:choose> <xsl:when test="contains(substring-after(@IS,concat(DEFname, '.')),' ')"> <xsl:value-of select="substring-before(substring-after(@IS,concat(DEFname, '.')),' ')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-after(@IS,concat(DEFname, '.'))"/> </xsl:otherwise> </xsl:choose> <xsl:text> IS </xsl:text> <xsl:value-of select="@name"/> <!-- this is @name of ProtoDeclare/field --> <xsl:text>&#10;</xsl:text> </xsl:if> </xsl:for-each> </xsl:if> </xsl:when> <!-- take care of wrapper tags (type Node/Nodes) defined in ProtoDeclare or ExternProtoDeclare --> <xsl:when test="(//ProtoDeclare[@name=parentNodeName or @name=parentNodeName2]/field[@name=nodeName and @type='Node']) or (//ExternProtoDeclare[@name=parentNodeName or @name=parentNodeName2]/field[@name=nodeName and @type='Node'])"> <xsl:value-of select="local-name ()"/><xsl:text> </xsl:text> </xsl:when> <xsl:when test="(//ProtoDeclare[@name=parentNodeName or @name=parentNodeName2]/field[(@name=nodeName or @name=nodeName2) and @type='Nodes']) or (//ExternProtoDeclare[@name=parentNodeName or @name=parentNodeName2]/field[(@name=nodeName or @name=nodeName2) and @type='Nodes'])"> <xsl:value-of select="local-name ()"/><xsl:text> [</xsl:text> </xsl:when> <!-- not a proxy or a USE NodeDefName or a ProtoInstance: so just output current node name and opening { --> <xsl:otherwise> <xsl:value-of select="local-name ()"/> <xsl:text> {&#10;</xsl:text> <!-- # *** otherwise clause --> </xsl:otherwise> </xsl:choose> <!-- ensure GeoOrigin handled before children, so that final close bracket ] doesn't encompass it --> <xsl:if test="(contains(local-name(),'Geo') or contains(nodeType,'Geo') or contains(EPnodeType,'Geo') or contains(nodeType,'Geo')) and (GeoOrigin) and not(local-name()='GeoOrigin') "> <!-- <xsl:text># GeoOrigin found for </xsl:text><xsl:value-of select="local-name()"/><xsl:text>&#10;</xsl:text> --> <xsl:apply-templates select="GeoOrigin"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:if> <!-- ensure GeoLOD/rootNode handled before children, so that final close bracket ] doesn't encompass it --> <xsl:if test="(local-name()='GeoLOD' and './rootNode')"> <!-- <xsl:text>&#10;# rootNode found for </xsl:text><xsl:value-of select="local-name()"/><xsl:text>&#10;</xsl:text> --> <xsl:apply-templates select="rootNode"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:if> <!-- match each of the attributes next, put this after children in case a referencing USE is employed --> <!-- get fields and sibling comment() nodes --> <xsl:apply-templates select="field | comment()[following-sibling::field]"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <!-- apply attributes, but watch out for special Humanoid attributes --> <xsl:choose> <xsl:when test="(local-name(.)='Humanoid')"> <xsl:apply-templates select="@*[local-name(.)='DEF' or local-name(.)='USE' or local-name(.)='bboxCenter' or local-name(.)='bboxSize' or local-name(.)='center' or local-name(.)='info' or local-name(.)='name' or local-name(.)='rotation' or local-name(.)='scale' or local-name(.)='scaleOrientation' or local-name(.)='translation' or local-name(.)='version']"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:text> info [ </xsl:text> <xsl:for-each select="@*[not(local-name(.)='DEF' or local-name(.)='USE' or local-name(.)='bboxSize' or local-name(.)='center' or local-name(.)='info' or local-name(.)='name' or local-name(.)='rotation' or local-name(.)='scale' or local-name(.)='scaleOrientation' or local-name(.)='translation' or local-name(.)='version')]"> <!-- @info collects attribute=value metadata pairs --> <xsl:text>&quot;</xsl:text> <xsl:value-of select="local-name(.)"/> <xsl:text>=</xsl:text> <xsl:value-of select="."/> <xsl:text>&quot; </xsl:text> </xsl:for-each> <xsl:text>]&#10;</xsl:text> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="@*"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> <!-- not working :( <xsl:apply-templates select="fieldValue[not(@USE) and not(descendant-or-self::*/@USE)]"/> --> <!-- a check for implicit attributes in the matching IS tokens is needed here... --> <xsl:if test="local-name()='proxy'"><xsl:text>proxy </xsl:text></xsl:if> <!-- check if this node has children, if so add appropriate VRML 97 child-node indicator --> <xsl:if test="* or comment()"> <xsl:choose> <!-- 4-way node-type tests: native VRML node, ProtoDeclared ProtoInstance, ExternProtoDeclared ProtoInstance, or internal DTD declaration by content --> <xsl:when test="((local-name()='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor' or local-name()='Billboard' or nodeType='Billboard' or EPnodeType='Billboard' or @nodeType='Billboard' or local-name()='Collision' or nodeType='Collision' or EPnodeType='Collision' or @nodeType='Collision' or local-name()='Group' or nodeType='Group' or EPnodeType='Group' or @nodeType='Group' or local-name()='Transform' or nodeType='Transform' or EPnodeType='Transform' or @nodeType='Transform' or local-name()='Contour2D' or nodeType='Contour2D' or EPnodeType='Contour2D' or @nodeType='Contour2D' or local-name()='CoordinateDeformer' or nodeType='CoordinateDeformer' or EPnodeType='CoordinateDeformer' or @nodeType='CoordinateDeformer' or local-name()='EspduTransform' or nodeType='EspduTransform' or EPnodeType='EspduTransform' or @nodeType='EspduTransform' or local-name()='GeoInline' or nodeType='GeoInline' or EPnodeType='GeoInline' or @nodeType='GeoInline' or local-name()='GeoLocation' or nodeType='GeoLocation' or EPnodeType='GeoLocation' or @nodeType='GeoLocation' or local-name()='GeoLOD' or nodeType='GeoLOD' or EPnodeType='GeoLOD' or @nodeType='GeoLOD' or local-name()='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint' or local-name()='NurbsGroup' or nodeType='NurbsGroup' or EPnodeType='NurbsGroup' or @nodeType='NurbsGroup' or local-name()='ReceiverPdu' or nodeType='ReceiverPdu' or EPnodeType='ReceiverPdu' or @nodeType='ReceiverPdu' or local-name()='Segment' or nodeType='Segment' or EPnodeType='Segment' or @nodeType='Segment' or local-name()='SignalPdu' or nodeType='SignalPdu' or EPnodeType='SignalPdu' or @nodeType='SignalPdu' or local-name()='Site' or nodeType='Site' or EPnodeType='Site' or @nodeType='Site' or local-name()='TransmitterPdu' or nodeType='TransmitterPdu' or EPnodeType='TransmitterPdu' or @nodeType='TransmitterPdu') and (children or ./*[local-name()!='proxy' and local-name()!='fieldValue' and local-name()!='GeoOrigin' and local-name()!='rootNode']) and not (local-name()='ProtoInstance' and @name='Humanoid') ) or children"> <!-- consider various child and prototype cases. must work wrapped or unwrapped! --> <xsl:choose> <xsl:when test="children/*[local-name()!='proxy']"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>children [&#10;</xsl:text> <xsl:apply-templates select="children/*[local-name()!='proxy'and local-name()!='ROUTE']"> <xsl:with-param name="indent" select="indent + 4"/> </xsl:apply-templates> </xsl:when> <xsl:when test="fieldValue[@name='children']/*"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>children [</xsl:text> <xsl:text> # found fieldValue[@name='children']/* </xsl:text> <!-- --> <xsl:text>&#10;</xsl:text> <xsl:apply-templates select="fieldValue[@name='children']/*"> <xsl:with-param name="indent" select="indent + 4"/> </xsl:apply-templates> </xsl:when> <xsl:when test="children"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>children NULL&#10;</xsl:text> </xsl:when> <!-- unwrapped children --> <xsl:when test="*[local-name()!='proxy' and local-name()!='fieldValue' and local-name()!='GeoOrigin' and local-name()!='rootNode']"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>children [</xsl:text> <!-- <xsl:text> # unwrapped children</xsl:text> --> <xsl:text>&#10;</xsl:text> <!-- <xsl:for-each select="*[local-name()!='proxy' and local-name()!='fieldValue' and local-name()!='GeoOrigin' and local-name()!='rootNode']"> #=== <xsl:text>&#10;</xsl:text></xsl:for-each> --> <xsl:apply-templates select="*[local-name()!='proxy' and local-name()!='fieldValue' and local-name()!='GeoOrigin' and local-name()!='rootNode' and local-name()!='ROUTE']"> <xsl:with-param name="indent" select="indent + 4"/> </xsl:apply-templates> </xsl:when> </xsl:choose> </xsl:when> <xsl:when test="(local-name()='LOD' or nodeType='LOD' or EPnodeType='LOD' or @nodeType='LOD') and (level/* or *[local-name()!='fieldValue'])"> <xsl:choose> <xsl:when test="level/*"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>level [&#10;</xsl:text> <xsl:apply-templates select="level"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <xsl:when test="level"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>level NULL&#10;</xsl:text> <xsl:apply-templates select="level"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <!-- unwrapped children --> <xsl:when test="*[local-name()!='fieldValue']"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>level [&#10;</xsl:text> <xsl:apply-templates select="*[local-name()!='fieldValue'and local-name()!='ROUTE']"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> </xsl:choose> </xsl:when> <xsl:when test="(local-name()='Switch' or nodeType='Switch' or EPnodeType='Switch' or @nodeType='Switch') and (choice/* or *[local-name()!='fieldValue'])"> <xsl:choose> <xsl:when test="choice/*"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>choice [&#10;</xsl:text> <xsl:apply-templates select="choice"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <xsl:when test="choice"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>choice NULL&#10;</xsl:text> <xsl:apply-templates select="choice"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <!-- unwrapped children --> <xsl:when test="*[local-name()!='fieldValue' and local-name()!='ROUTE']"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>choice [&#10;</xsl:text> <xsl:apply-templates select="*[local-name()!='fieldValue' and local-name()!='ROUTE']"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> </xsl:choose> </xsl:when> <xsl:otherwise> <!-- recurse on non-proxy, non-ROUTE, non-fieldValue, non-children, non-level, non-range child nodes --> <!-- this rule is unnecessary for unwrapped compact-version tagset --> <!-- <xsl:text># ***** otherwise recurse on other tags&#10;</xsl:text> --> <xsl:apply-templates select="*[(local-name()!='proxy' and local-name()!='ROUTE' and local-name()!='field' and local-name()!='fieldValue' and local-name()!='children' and local-name()!='level' and local-name()!='choice' and local-name()!='GeoOrigin' and local-name()!='rootNode' and local-name(..)!='Humanoid')] | comment()[not(following-sibling::field)]"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:apply-templates select="*[local-name(..)='Humanoid' and (local-name()='humanoidBody' or local-name()='skeleton')]"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> <!-- check if this is a parent grouping node (and not a USE) then add children close ] --> <!-- 4-way node-type tests: native VRML node, ProtoDeclared ProtoInstance, ExternProtoDeclared ProtoInstance, or internal DTD declaration by content --> <xsl:variable name="otherChildrenFoundTest1" select="not(@USE) and ((local-name()='GeoInline' or nodeType='GeoInline' or EPnodeType='GeoInline' or @nodeType='GeoInline' or local-name()='GeoLocation' or nodeType='GeoLocation' or EPnodeType='GeoLocation' or @nodeType='GeoLocation' or local-name()='GeoLOD' or nodeType='GeoLOD' or EPnodeType='GeoLOD' or @nodeType='GeoLOD' or local-name()='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint' or local-name()='Segment' or nodeType='Segment' or EPnodeType='Segment' or @nodeType='Segment' or local-name()='Site' or nodeType='Site' or EPnodeType='Site' or @nodeType='Site' or local-name()='EspduTransform' or nodeType='EspduTransform' or EPnodeType='EspduTransform' or @nodeType='EspduTransform' or local-name()='Contour2D' or nodeType='Contour2D' or EPnodeType='Contour2D' or @nodeType='Contour2D' or local-name()='CoordinateDeformer' or nodeType='CoordinateDeformer' or EPnodeType='CoordinateDeformer' or @nodeType='CoordinateDeformer' or local-name()='NurbsGroup' or nodeType='NurbsGroup' or EPnodeType='NurbsGroup' or @nodeType='NurbsGroup' or local-name()='ReceiverPdu' or nodeType='ReceiverPdu' or EPnodeType='ReceiverPdu' or @nodeType='ReceiverPdu' or local-name()='SignalPdu' or nodeType='SignalPdu' or EPnodeType='SignalPdu' or @nodeType='SignalPdu' or local-name()='TransmitterPdu' or nodeType='TransmitterPdu' or EPnodeType='TransmitterPdu' or @nodeType='TransmitterPdu') and *[local-name()!='GeoOrigin' and local-name()!='rootNode']) "/> <xsl:variable name="otherChildrenFoundTest2" select="not(@USE) and (((local-name(..)='GeoLOD' and local-name()='rootNode' and *) or (local-name(..)='Segment') and local-name()='displacers' or (local-name(..)='Humanoid' and (local-name()='humanoidBody' or local-name()='skeleton' or local-name()='joints' or local-name()='segments' or local-name()='sites' or local-name()='viewpoints')) ) and * ) "/> <!-- <xsl:text> # otherChildrenFoundTest1 </xsl:text><xsl:value-of select="otherChildrenFoundTest1"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # otherChildrenFoundTest2 </xsl:text><xsl:value-of select="otherChildrenFoundTest2"/><xsl:text>&#10;</xsl:text> --> <xsl:if test="not(@USE) and (((local-name()='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor' or local-name()='Billboard' or nodeType='Billboard' or EPnodeType='Billboard' or @nodeType='Billboard' or local-name()='Collision' or nodeType='Collision' or EPnodeType='Collision' or @nodeType='Collision' or local-name()='Group' or nodeType='Group' or EPnodeType='Group' or @nodeType='Group' or local-name()='Transform' or nodeType='Transform' or EPnodeType='Transform' or @nodeType='Transform' or local-name()='Inline' or nodeType='Inline' or EPnodeType='Inline' or @nodeType='Inline') and (children/* or *[local-name()!='proxy' and local-name()!='fieldValue' and local-name()!='GeoOrigin' and local-name()!='rootNode']) and not (local-name()='ProtoInstance' and @name='Humanoid')) or ((local-name()='LOD' or nodeType='LOD' or EPnodeType='LOD' or @nodeType='LOD') and (level/* or *[local-name()!='fieldValue'])) or ((local-name()='Switch' or nodeType='Switch' or EPnodeType='Switch' or @nodeType='Switch') and (choice/* or *[local-name()!='fieldValue'])) or (//ProtoDeclare[@name=parentNodeName or @name=parentNodeName2]/field[(@name=nodeName or @name=nodeName2) and @type='Nodes']) or (//ExternProtoDeclare[@name=parentNodeName or @name=parentNodeName2]/field[(@name=nodeName or @name=nodeName2) and @type='Nodes']) or otherChildrenFoundTest1 or otherChildrenFoundTest2) "> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>]</xsl:text> <!-- <xsl:text> # local-name()=</xsl:text><xsl:value-of select="local-name()"/> --> <xsl:text>&#10;</xsl:text> </xsl:if> </xsl:if> <!-- process any child ROUTEs after ] close right bracket --> <xsl:apply-templates select="ROUTE"> <xsl:with-param name="indent" select="indent"/> </xsl:apply-templates> <!-- proxy test & output, put this after children in case a referencing USE is employed --> <xsl:if test="(local-name()='Collision' or nodeType='Collision' or EPnodeType='Collision' or @nodeType='Collision') and ./proxy"> <xsl:apply-templates select="proxy"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:if> <!-- output fieldValues that contain @USE last in case USEd nodes are referenced in adjacent siblings. --> <xsl:apply-templates select="fieldValue"> <!-- [@name!='children'] --> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <!-- ensure Humanoid child nodes handled after children, so that USE values are available --> <xsl:if test="local-name()='Humanoid' "> <xsl:if test="joints/* or Joint"> <xsl:text>joints [&#10;</xsl:text> <xsl:apply-templates select="joints/*"></xsl:apply-templates> <xsl:apply-templates select="Joint"></xsl:apply-templates> <xsl:text>]&#10;</xsl:text> </xsl:if> <xsl:if test="segments/* or Segment"> <xsl:text>segments [&#10;</xsl:text> <xsl:apply-templates select="segments/*"></xsl:apply-templates> <xsl:apply-templates select="Segment"></xsl:apply-templates> <xsl:text>]&#10;</xsl:text> </xsl:if> <xsl:if test="sites/* or Site"> <xsl:text>sites [&#10;</xsl:text> <xsl:apply-templates select="sites/*"></xsl:apply-templates> <xsl:apply-templates select="Site"></xsl:apply-templates> <xsl:text>]&#10;</xsl:text> </xsl:if> <xsl:if test="skinCoord"> <xsl:text>skinCoord &#10;</xsl:text> <xsl:apply-templates select="skinCoord/*"></xsl:apply-templates> <xsl:text>&#10;</xsl:text> </xsl:if> <xsl:if test="skinNormal"> <xsl:text>skinNormal &#10;</xsl:text> <xsl:apply-templates select="skinNormal/*"></xsl:apply-templates> <xsl:text>&#10;</xsl:text> </xsl:if> <xsl:if test="skin"> <xsl:text>skin [&#10;</xsl:text> <xsl:apply-templates select="skin/*"></xsl:apply-templates> <xsl:text>]&#10;</xsl:text> </xsl:if> <xsl:if test="viewpoints/* or Viewpoint"> <xsl:text>viewpoints [&#10;</xsl:text> <xsl:apply-templates select="viewpoints/*"></xsl:apply-templates> <xsl:apply-templates select="Viewpoint"></xsl:apply-templates> <xsl:text>]&#10;</xsl:text> </xsl:if> </xsl:if> <!-- contained content for Script node is scripting code and output as part of url, following regular @url (if any) --> <xsl:if test="(local-name()='Script' or @nodeType='Script')"><!-- ignore EPnodeType='Script' or nodeType='Script' since it may represent something else --> <xsl:if test="(normalize-space(@url)='' or normalize-space(@url)=' ') and (normalize-space(.)='' or normalize-space(.)=' ')"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Script node has neither url nor contained code in CDATA section</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> </xsl:if> <xsl:if test="@url and (starts-with(normalize-space(.),'javascript:') or normalize-space(.))"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Script node url precedes Script's contained code of CDATA section</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> </xsl:if> <xsl:if test="@directOutput='true' and not((field/@type='Node') or (field/@type='Nodes'))"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Script attribute directOutput='true' only appropriate when field(s) of type Node/Nodes provided for direct access</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> </xsl:if> <xsl:if test="not(@directOutput='true') and ((field/@type='Node') or (field/@type='Nodes'))"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Script attribute directOutput='true' usually needed when field(s) of type Node/Nodes are present. directOutput false means Script is not allowed to modify referenced nodes.</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> </xsl:if> <xsl:text>url [ </xsl:text> <!-- first is url value(s), presented first so that external (possibly updated) code takes precedence --> <xsl:choose> <!-- wrap url in quote marks when needed --> <xsl:when test="@url and not(starts-with(normalize-space(@url),'"'))"> <xsl:text>&quot;</xsl:text> <xsl:value-of select="@url" /> <xsl:text>&quot;</xsl:text> <xsl:text>&#10;</xsl:text> </xsl:when> <!-- url quote marks not needed --> <xsl:when test="@url"> <xsl:value-of select="@url" /> <xsl:text>&#10;</xsl:text> </xsl:when> </xsl:choose> <!-- next is contained code --> <xsl:if test="not(normalize-space(.)='')"> <xsl:if test="not(starts-with(normalize-space(.),'"'))"> <xsl:text>&quot;</xsl:text> </xsl:if> <xsl:text>javascript:</xsl:text> <!-- CosmoPlayer url must start with javascript: or else it fails. Update to handle other script language source when supported. --> <xsl:for-each select="text()"> <xsl:choose> <xsl:when test="(normalize-space(.)='' or normalize-space(.)=' ') and preceding::field"></xsl:when><!--<xsl:text>// stripped LF before field&#10;</xsl:text> --> <xsl:when test="(normalize-space(.)='' or normalize-space(.)=' ') and following::field"></xsl:when><!--<xsl:text>// stripped LF after field&#10;</xsl:text> --> <xsl:when test="substring-before(.,'javascript:') or 'j'=substring-before(.,'avascript:')"></xsl:when> <xsl:otherwise><xsl:value-of select="normalize-space(.)" /></xsl:otherwise><!--translate(,'javascript:','')--> </xsl:choose> </xsl:for-each> <xsl:text>&#10;</xsl:text> <xsl:if test="not(starts-with(normalize-space(.),'"'))"> <xsl:text>&quot;</xsl:text> </xsl:if> </xsl:if> <xsl:text> ]&#10;</xsl:text> </xsl:if> <!-- if not a USE or proxy, then add node close } --> <xsl:if test="not(@USE) and not(local-name()='USE') and not(local-name()='proxy') and not(local-name(..)='GeoLOD' and local-name()='rootNode') and not(local-name(..)='Segment' and local-name()='displacers') and not(local-name(..)='Humanoid' and (local-name()='humanoidBody' or local-name()='skeleton'))"> <!-- <xsl:text># local-name()=</xsl:text><xsl:value-of select="local-name()"/><xsl:text>&#10;</xsl:text> --> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>}&#10;</xsl:text> </xsl:if> <!-- done translating this node --> </xsl:template> <!-- ****** recurse through each of the attributes ****** --> <xsl:template match="@*"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<!-- eliminate default attribute values, otherwise they will _all_ appear in output --> <!-- this block is used identically in X3dToVrml97.xsl X3dToHtml.xsl X3dUnwrap.xsl and X3dWrap.xsl --> <!-- check values with/without .0 suffix since these are string checks and autogenerated/DOM output might have either --> <!-- do not check ProtoInstances or natively defined nodes, since they might have different user-defined defaults --> <!-- tool-bug workaround: split big boolean queries into pieces to avoid overloading the Xalan/lotusxml query buffer --> <xsl:variable name="notImplicitEvent" select="not(local-name(..)='AudioClip' and (local-name()='duration' or local-name()='isActive')) and not(contains(local-name(..),'Interpolator') and (local-name()='fraction' or local-name()='value')) and not(local-name(..)='Background' and (local-name()='bind' or local-name()='bindTime' or local-name()='isBound')) and not(local-name(..)='CylinderSensor' and (local-name()='isActive' or local-name()='rotation' or local-name()='trackPoint')) and not(local-name(..)='Fog' and (local-name()='bind' or local-name()='bindTime' or local-name()='isBound')) and not(local-name(..)='IndexedLineSet' and local-name()='lineWidth') and not(local-name(..)='MovieTexture' and (local-name()='duration' or local-name()='isActive')) and not(local-name(..)='NavigationInfo' and (local-name()='bind' or local-name()='bindTime' or local-name()='isBound')) and not(local-name(..)='PointSet' and local-name()='pointSize') and not(local-name(..)='PlaneSensor' and (local-name()='isActive' or local-name()='translation' or local-name()='trackPoint')) and not(local-name(..)='ProximitySensor' and (local-name()='isActive' or local-name()='position' or local-name()='orientation' or local-name()='enterTime' or local-name()='exitTime')) and not(local-name(..)='SphereSensor' and (local-name()='isActive' or local-name()='rotation' or local-name()='trackPoint')) and not(local-name(..)='TimeSensor' and (local-name()='isActive' or local-name()='cycleTime' or local-name()='fraction' or local-name()='time')) and not(local-name(..)='TouchSensor' and (local-name()='isActive' or local-name()='isOver' or local-name()='hitNormal' or local-name()='touchTime' or local-name()='hitPoint' or local-name()='hitTexCoord')) and not(local-name(..)='Viewpoint' and (local-name()='bind' or local-name()='bindTime' or local-name()='isBound' or local-name()='examine')) and not(local-name(..)='GeoViewpoint' and (local-name()='bind' or local-name()='bindTime' or local-name()='isBound' or local-name()='examine')) " /> <xsl:variable name="notDefaultFieldValue1" select="not( local-name()='bboxCenter' and (.='0 0 0' or .='0.0 0.0 0.0')) and not( local-name()='bboxSize' and (.='-1 -1 -1' or .='-1.0 -1.0 -1.0')) and not( local-name(..)='X3D' and local-name()='version' and (.='3.0')) and not( local-name(..)='AudioClip' and ((local-name()='loop' and .='false') or (local-name()='pitch' and (.='1' or .='1.0')) or (local-name()='startTime' and (.='0' or .='0.0')) or (local-name()='stopTime' and (.='0 0 0' or .='0.0 0.0 0.0')))) and not( local-name(..)='Background' and local-name()='skyColor' and (.='0 0 0' or .='0.0 0.0 0.0')) and not( local-name(..)='Billboard' and local-name()='axisOfRotation' and (.='0 1 0' or .='0.0 1.0 0.0')) and not( local-name(..)='Box' and local-name()='size' and (.='2 2 2' or .='2.0 2.0 2.0')) and not( local-name(..)='Collision' and local-name()='collide' and .='true') and not( local-name(..)='Cone' and ((local-name()='bottomRadius' and (.='1' or .='1.0')) or (local-name()='height' and (.='2' or .='2.0')) or (local-name()='side' and .='true') or (local-name()='bottom' and .='true'))) and not( local-name(..)='Cylinder' and ((local-name()='height' and (.='2' or .='2.0')) or (local-name()='radius' and (.='1' or .='1.0')) or (local-name()='bottom' and .='true') or (local-name()='side' and .='true') or (local-name()='top' and .='true'))) and not( local-name(..)='CylinderSensor' and ((local-name()='autoOffset' and .='true') or (local-name()='enabled' and .='true') or (local-name()='diskAngle' and .='0.262') or (local-name()='offset' and (.='0' or .='0.0')) or (local-name()='maxAngle' and (.='-1' or .='-1.0')) or (local-name()='minAngle' and (.='0' or .='0.0'))))" /> <xsl:variable name="notDefaultFieldValue2" select="not( local-name(..)='DirectionalLight' and ((local-name()='ambientIntensity' and (.='0' or .='0.0')) or (local-name()='color' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='direction' and (.='0 0 -1' or .='0.0 0.0 -1.0')) or (local-name()='intensity' and (.='1' or .='1.0')) or (local-name()='on' and .='true'))) and not( (local-name(..)='ElevationGrid' or local-name(..)='GeoElevationGrid') and ((local-name()='ccw' and .='true') or (local-name()='colorPerVertex' and .='true') or (local-name()='normalPerVertex' and .='true') or (local-name()='solid' and .='true') or (local-name()='xDimension' and (.='0' or .='0.0')) or (local-name()='xSpacing' and (.='1' or .='1.0')) or (local-name()='zDimension' and (.='0' or .='0.0')) or (local-name()='zSpacing' and (.='1' or .='1.0')) or (local-name()='creaseAngle' and (.='0' or .='0.0')))) and not( local-name(..)='Extrusion' and ((local-name()='beginCap' and .='true') or (local-name()='ccw' and .='true') or (local-name()='convex' and .='true') or (local-name()='endCap' and .='true') or (local-name()='solid' and .='true') or (local-name()='creaseAngle' and (.='0' or .='0.0')) or (local-name()='orientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='scale' and (.='1 1' or .='1.0 1.0')) or (local-name()='crossSection' and .='1 1, 1 -1, -1 -1, -1 1, 1 1') or (local-name()='crossSection' and .='1 1 1 -1 -1 -1 -1 1 1 1') or (local-name()='spine' and .='0 0 0, 0 1 0') or (local-name()='spine' and .='0 0 0 0 1 0')))" /> <xsl:variable name="notDefaultFieldValue3" select="not( local-name(..)='Fog' and ((local-name()='color' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='visibilityRange' and (.='0' or .='0.0')) or (local-name()='fogType' and .='"LINEAR"'))) and not( local-name(..)='FontStyle' and ((local-name()='horizontal' and .='true') or (local-name()='leftToRight' and .='true') or (local-name()='topToBottom' and .='true') or (local-name()='size' and (.='1' or .='1.0')) or (local-name()='spacing' and (.='1' or .='1.0')) or (local-name()='family' and .='"SERIF"') or (local-name()='justify' and .='"BEGIN"') or (local-name()='family' and .='SERIF') or (local-name()='justify' and .='BEGIN') or (local-name()='style' and .='PLAIN'))) and not( local-name(..)='ImageTexture' and ((local-name()='repeatS' and .='true') or (local-name()='repeatT' and .='true'))) and not( local-name(..)='IndexedFaceSet' and ((local-name()='ccw' and .='true') or (local-name()='colorPerVertex' and .='true') or (local-name()='convex' and .='true') or (local-name()='normalPerVertex' and .='true') or (local-name()='solid' and .='true') or (local-name()='creaseAngle' and (.='0' or .='0.0')))) and not( local-name(..)='IndexedLineSet' and local-name()='colorPerVertex' and .='true') and not( local-name(..)='LOD' and local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) and not( local-name(..)='Material' and ((local-name()='ambientIntensity' and .='0.2') or (local-name()='diffuseColor' and .='0.8 0.8 0.8') or (local-name()='emissiveColor' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='shininess' and .='0.2') or (local-name()='specularColor' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='transparency' and (.='0' or .='0.0'))))" /> <xsl:variable name="notDefaultFieldValue4" select="not( local-name(..)='MovieTexture' and ((local-name()='loop' and .='false') or (local-name()='speed' and (.='1' or .='1.0')) or (local-name()='startTime' and (.='0' or .='0.0')) or (local-name()='stopTime' and (.='0' or .='0.0')) or (local-name()='repeatS' and .='true') or (local-name()='repeatT' and .='true'))) and not( local-name(..)='NavigationInfo' and ((local-name()='avatarSize' and .='0.25 1.6 0.75') or (local-name()='headlight' and .='true') or (local-name()='speed' and (.='1' or .='1.0')) or (local-name()='visibilityLimit' and (.='0' or .='0.0')))) and not( local-name(..)='PixelTexture' and ((local-name()='repeatS' and .='true') or (local-name()='repeatT' and .='true') or (local-name()='image' and (.='0 0 0' or .='0.0 0.0 0.0')))) and not( local-name(..)='PlaneSensor' and ((local-name()='autoOffset' and .='true') or (local-name()='enabled' and .='true') or (local-name()='maxPosition' and (.='-1 -1' or .='-1.0 -1.0')) or (local-name()='minPosition' and (.='0 0' or .='0.0 0.0')) or (local-name()='offset' and (.='0 0 0' or .='0.0 0.0 0.0')))) and not( local-name(..)='PointLight' and ((local-name()='ambientIntensity' and (.='0' or .='0.0'))or (local-name()='attenuation' and (.='1 0 0' or .='1.0 0.0 0.0')) or (local-name()='color' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='intensity' and (.='1' or .='1.0')) or (local-name()='location' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='on' and .='true') or (local-name()='radius' and (.='100' or .='100.0'))))" /> <xsl:variable name="notDefaultFieldValue5" select="not( local-name(..)='ProximitySensor' and ((local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='size' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='enabled' and .='true'))) and not( local-name(..)='Script' and ((local-name()='directOutput' and .='false') or (local-name()='mustEvaluate' and .='false'))) and not( local-name(..)='Sound' and ((local-name()='direction' and (.='0 0 1' or .='0.0 0.0 1.0')) or (local-name()='intensity' and (.='1' or .='1.0')) or (local-name()='location' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='priority' and (.='0' or .='0.0')) or (local-name()='maxBack' and (.='10' or .='10.0')) or (local-name()='maxFront' and (.='10' or .='10.0')) or (local-name()='minBack' and (.='1' or .='1.0')) or (local-name()='minFront' and (.='1' or .='1.0')) or (local-name()='spatialize' and .='true'))) and not( local-name(..)='Sphere' and local-name()='radius' and (.='1' or .='1.0')) and not( local-name(..)='SphereSensor' and ((local-name()='autoOffset' and .='true') or (local-name()='enabled' and .='true') or (local-name()='offset' and (.='0 1 0 0' or .='0.0 1.0 0.0 0.0'))))" /> <xsl:variable name="notDefaultFieldValue6" select="not( parent::SpotLight and ((local-name()='ambientIntensity' and (.='0' or .='0.0')) or (local-name()='attenuation' and (.='1 0 0' or .='1.0 0.0 0.0')) or (local-name()='beamwidth' and .='1.570796') or (local-name()='color' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='cutOffAngle' and .='0.785398') or (local-name()='direction' and (.='0 0 -1' or .='0.0 0.0 -1.0')) or (local-name()='intensity' and (.='1' or .='1.0')) or (local-name()='location' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='on' and .='true') or (local-name()='radius' and (.='100' or .='100.0')))) and not( local-name(..)='Switch' and local-name()='whichChoice' and (.='-1' or .='-1.0')) and not( local-name(..)='Text' and local-name()='maxExtent' and (.='0' or .='0.0')) and not( local-name(..)='TextureTransform' and ((local-name()='center' and (.='0 0' or .='0.0 0.0')) or (local-name()='rotation' and (.='0' or .='0.0')) or (local-name()='scale ' and (.='1 1' or .='1.0 1.0')) or (local-name()='translation' and (.='0 0' or .='0.0 0.0')))) and not( local-name(..)='Switch' and local-name()='whichChoice' and (.='-1' or .='-1.0'))" /> <xsl:variable name="notDefaultFieldValue7" select="not( local-name(..)='TimeSensor' and ((local-name()='cycleInterval' and (.='1' or .='1.0')) or (local-name()='enabled' and .='true') or (local-name()='startTime' and (.='0' or .='0.0')) or (local-name()='stopTime' and (.='0' or .='0.0')) or (local-name()='loop' and .='false'))) and not( local-name(..)='TouchSensor' and local-name()='enabled' and .='true') and not( local-name(..)='Transform' and ((local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='rotation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='scale' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='scaleOrientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='translation' and (.='0 0 0' or .='0.0 0.0 0.0')))) and not( (local-name(..)='Viewpoint' or local-name(..)='GeoViewpoint') and ((local-name()='fieldOfView' and .='0.785398') or (local-name()='jump' and .='true') or (local-name()='orientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='position' and (.='0 0 10' or .='0.0 0.0 10.0')))) and not( local-name(..)='VisibilitySensor' and ((local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='enabled' and .='true') or (local-name()='size' and (.='0 0 0' or .='0.0 0.0 0.0'))))" /> <xsl:variable name="notDefaultHAnim" select="not( local-name(..)='Joint' and ((local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='limitOrientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='rotation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='scale' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='scaleOrientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='stiffness' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='translation' and (.='0 0 0' or .='0.0 0.0 0.0')))) and not( local-name(..)='Segment' and ((local-name()='bboxCenter' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='bboxSize' and (.='-1 -1 -1' or .='-1.0 -1.0 -1.0')) or (local-name()='centerOfMass' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='mass' and (.='0' or .='0.0')) or (local-name()='momentsOfInertia' and (.='0 0 0 0 0 0 0 0 0' or .='0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0')))) and not( local-name(..)='Site' and ((local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='rotation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='scale' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='scaleOrientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='translation' and (.='0 0 0' or .='0.0 0.0 0.0')))) and not( local-name(..)='Humanoid' and ((local-name()='bboxCenter' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='bboxSize' and (.='-1 -1 -1' or .='-1.0 -1.0 -1.0')) or (local-name()='center' and (.='0 0 0' or .='0.0 0.0 0.0')) or (local-name()='rotation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='scale' and (.='1 1 1' or .='1.0 1.0 1.0')) or (local-name()='scaleOrientation' and (.='0 0 1 0' or .='0.0 0.0 1.0 0.0')) or (local-name()='translation' and (.='0 0 0' or .='0.0 0.0 0.0'))))" /> <xsl:variable name="notDefaultLatticeXvl" select="not( local-name(..)='XvlShell' and ((local-name()='shellType' and .='LATTICE_MESH') or (local-name()='numberOfDivisions' and .='4')) )" /> <!-- avoid outputting: DEF, any fields whatsoever if USE found, ProtoInstance name, new VRML fields (pointSize etc.), hint attribute, implicitly specified VRML 97 eventIns/eventOuts, missing values or default values --> <xsl:variable name="notDefaultValue" select="not(local-name()='DEF') and not(local-name()='nodeType') and not(local-name()='USE') and not(../@USE) and not(.='') and not(local-name(..)='ProtoInstance' and local-name()='name') and not( local-name(..)='IndexedLineSet' and local-name()='lineWidth') and not(local-name(..)='PointSet' and local-name()='pointSize') and not(local-name(..)='USE' and local-name()='node') and notImplicitEvent and notDefaultFieldValue1 and notDefaultFieldValue2 and notDefaultFieldValue3 and notDefaultFieldValue4 and notDefaultFieldValue5 and notDefaultFieldValue6 and notDefaultFieldValue7 and notDefaultHAnim and notDefaultLatticeXvl and not((local-name(..)='Script' or local-name(..)='field') and (local-name()='xml:space' or local-name()='space')) and not((local-name(..)='Script') and local-name()='url')"/> <xsl:if test="notDefaultValue"> <!-- valid field found by the preceding checks, now output accordingly --> <xsl:call-template name="print-indent"></xsl:call-template> <!-- <xsl:text> # attribute </xsl:text><xsl:value-of select="local-name()"/><xsl:text>&#10;</xsl:text> --> <!-- take care of IS attribute definitions for non-node fields inside ProtoDeclarations --> <xsl:variable name="PROTOdeclareAncestorName" select="ancestor::*[local-name()='ProtoDeclare']/@name" /> <!-- <xsl:if test="PROTOdeclareAncestorName"> # ProtoDeclare ancestor "<xsl:text>&quot; found&#10;</xsl:text></xsl:if> --> <xsl:variable name="DEFname" select="../@DEF" /> <xsl:variable name="fieldName" select="local-name()" /> <xsl:variable name="matchName" select="concat(../@DEF,'.',local-name())" /> <!-- <xsl:text> # DEFname </xsl:text><xsl:value-of select="DEFname"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # fieldName </xsl:text><xsl:value-of select="fieldName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # matchName </xsl:text><xsl:value-of select="matchName"/><xsl:text>&#10;</xsl:text> --> <xsl:variable name="PROTOdeclareAncestorField" select="ancestor::*[local-name()='ProtoDeclare']/field" /> <!-- <xsl:if test="PROTOdeclareAncestorField"> # ProtoDeclare ancestor field "<xsl:text>&quot; found&#10;</xsl:text></xsl:if> --> <!-- figure out node type for ProtoDeclared ProtoInstance, ExternProtoDeclared ProtoInstance and internal DTD declaration tag definitions --> <xsl:variable name="nodeName" select="../@name" /> <xsl:variable name="nodeName2" select="local-name(..)" /> <xsl:variable name="parentNodeName" select="../../@name" /> <!-- ProtoDeclared ProtoInstance --> <xsl:variable name="nodeType" select="local-name(//ProtoDeclare[@name=nodeName or @name=nodeName2]/node()[local-name()!='field'])" /> <xsl:variable name="parentType" select="local-name(//ProtoDeclare[@name=parentNodeName]/node()[local-name()!='field'])" /> <!-- ExternProtoDeclared ProtoInstance --> <xsl:variable name="EPnodeName" select="//ExternProtoDeclare[@name=nodeName or @name=nodeName2]/@name" /> <xsl:variable name="EPnodeType" select="//ExternProtoDeclare[@name=nodeName or @name=nodeName2]/@nodeType" /> <xsl:variable name="EPfieldType" select="//ExternProtoDeclare[@name=nodeName or @name=nodeName2]/field[@name=fieldName]/@type" /> <!-- debug diagnosis statements --> <!-- <xsl:if test="nodeName"># nodeName <xsl:text>&#10;</xsl:text></xsl:if> --> <!-- <xsl:text># nodeName </xsl:text><xsl:value-of select="nodeName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeName2 </xsl:text><xsl:value-of select="nodeName2"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># local-name() </xsl:text><xsl:value-of select="local-name()"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># local-name(..) </xsl:text><xsl:value-of select="local-name(..)"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPnodeName </xsl:text><xsl:value-of select="EPnodeName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># parentNodeName </xsl:text><xsl:value-of select="parentNodeName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeType </xsl:text><xsl:value-of select="nodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># parentType </xsl:text><xsl:value-of select="parentType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPnodeType </xsl:text><xsl:value-of select="EPnodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPparentType </xsl:text><xsl:value-of select="EPparentType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># @nodeType </xsl:text><xsl:value-of select="@nodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPfieldType </xsl:text><xsl:value-of select="EPfieldType"/><xsl:text>&#10;</xsl:text> --> <xsl:variable name="BooleansTypes" select="(nodeType ='Booleans') or (EPnodeType='Booleans') or ((local-name(..)='XvlShell' or nodeType='XvlShell' or EPnodeType='XvlShell' or @nodeType='XvlShell') and (local-name()='faceEmpty' or local-name()='faceHidden'))" /> <xsl:variable name="MFtypes" select="(nodeType ='Colors') or (nodeType ='Floats') or (nodeType ='Integers') or (nodeType ='Rotations') or (nodeType ='Times') or (nodeType ='Vector2FloatArray') or (nodeType ='Vector3FloatArray') or (EPnodeType='Colors') or (EPnodeType='Floats') or (EPnodeType='Integers') or (EPnodeType='Rotations') or (EPnodeType='Times') or (EPnodeType='Vector2FloatArray') or (EPnodeType='Vector3FloatArray')" /> <xsl:variable name="ExtensionMFtypes" select=" ((local-name(..)='GeoElevationGrid' or nodeType='GeoElevationGrid' or EPnodeType='GeoElevationGrid' or @nodeType='GeoElevationGrid') and local-name()='height') or ((local-name(..)='GeoPositionInterpolator' or nodeType='GeoPositionInterpolator' or EPnodeType='GeoPositionInterpolator' or @nodeType='GeoPositionInterpolator') and local-name()='key') or ((local-name(..)='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint') and (local-name()='llimit' or local-name()='stiffness' or local-name()='ulimit')) or ((local-name(..)='Segment' or nodeType='Segment' or EPnodeType='Segment' or @nodeType='Segment') and local-name()='momentsOfInertia') or (EPnodeType='Vector3FloatArray') or ((local-name(..)='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint') and (local-name()='skinCoordIndex' or local-name()='skinCoordWeight') or ((local-name(..)='XvlShell' or nodeType='XvlShell' or EPnodeType='XvlShell' or @nodeType='XvlShell') and (local-name()='vertexRound' or local-name()='edgeBeginCoordIndex' or local-name()='edgeEndCoordIndex' or local-name()='edgeRound' or local-name()='edgeBeginVector' or local-name()='edgeEndVector' or local-name()='faceCoordIndex' or local-name()='faceTexCoordIndex')))" /> <xsl:variable name="GeoSpatialSFStringTypes" select="((local-name(..)='GeoElevationGrid' or nodeType='GeoElevationGrid' or EPnodeType='GeoElevationGrid' or @nodeType='GeoElevationGrid') and (local-name()='geoGridOrigin' or local-name()='xSpacing' or local-name()='zSpacing')) or ((local-name(..)='GeoLocation' or nodeType='GeoLocation' or EPnodeType='GeoLocation' or @nodeType='GeoLocation') and local-name()='geoCoords') or ((local-name(..)='GeoLOD' or nodeType='GeoLOD' or EPnodeType='GeoLOD' or @nodeType='GeoLOD') and local-name()='center') or ((local-name(..)='GeoMetadata' or nodeType='GeoMetadata' or EPnodeType='GeoMetadata' or @nodeType='GeoMetadata') and not(local-name()='url') and not(local-name()='data') and not(local-name()='summary')) or ((local-name(..)='GeoOrigin' or nodeType='GeoOrigin' or EPnodeType='GeoOrigin' or @nodeType='GeoOrigin') and local-name()='geoCoords') or ((local-name(..)='GeoPositionInterpolator' or nodeType='GeoPositionInterpolator' or EPnodeType='GeoPositionInterpolator' or @nodeType='GeoPositionInterpolator') and local-name()='geoValue') or ((local-name(..)='GeoTouchSensor' or nodeType='GeoTouchSensor' or EPnodeType='GeoTouchSensor' or @nodeType='GeoTouchSensor') and (local-name()='hitNormal' or local-name()='hitGeoCoordinate' or local-name()='hitTexCoord')) or ((local-name(..)='GeoViewpoint' or nodeType='GeoViewpoint' or EPnodeType='GeoViewpoint' or @nodeType='GeoViewpoint') and (local-name()='position' or local-name()='description'))" /> <xsl:variable name="GeoSpatialMFStringTypes" select="((local-name(..)='GeoCoordinate' or nodeType='GeoCoordinate' or EPnodeType='GeoCoordinate' or @nodeType='GeoCoordinate') and (local-name()='geoSystem' or local-name()='point')) or ((local-name(..)='GeoElevationGrid' or nodeType='GeoElevationGrid' or EPnodeType='GeoElevationGrid' or @nodeType='GeoElevationGrid') and local-name()='geoSystem') or ((local-name(..)='GeoInline' or nodeType='GeoInline' or EPnodeType='GeoInline' or @nodeType='GeoInline') and local-name()='url') or ((local-name(..)='GeoLocation' or nodeType='GeoLocation' or EPnodeType='GeoLocation' or @nodeType='GeoLocation') and local-name()='geoSystem') or ((local-name(..)='GeoLOD' or nodeType='GeoLOD' or EPnodeType='GeoLOD' or @nodeType='GeoLOD') and (contains(local-name(),'Url') or local-name()='geoSystem')) or ((local-name(..)='GeoMetadata' or nodeType='GeoMetadata' or EPnodeType='GeoMetadata' or @nodeType='GeoMetadata') and (local-name()='url' or local-name()='summary')) or ((local-name(..)='GeoOrigin' or nodeType='GeoOrigin' or EPnodeType='GeoOrigin' or @nodeType='GeoOrigin') and local-name()='geoSystem') or ((local-name(..)='GeoPositionInterpolator' or nodeType='GeoPositionInterpolator' or EPnodeType='GeoPositionInterpolator' or @nodeType='GeoPositionInterpolator') and (local-name()='geoSystem' or local-name()='keyValue')) or ((local-name(..)='GeoTouchSensor' or nodeType='GeoTouchSensor' or EPnodeType='GeoTouchSensor' or @nodeType='GeoTouchSensor') and local-name()='geoSystem') or ((local-name(..)='GeoViewpoint' or nodeType='GeoViewpoint' or EPnodeType='GeoViewpoint' or @nodeType='GeoViewpoint') and (local-name()='geoSystem' or local-name()='navType'))" /> <xsl:variable name="HAnimSFStringTypes" select="((local-name(..)='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint') and local-name()='name') or ((local-name(..)='Segment' or nodeType='Segment' or EPnodeType='Segment' or @nodeType='Segment') and local-name()='name') or ((local-name(..)='Site' or nodeType='Site' or EPnodeType='Site' or @nodeType='Site') and local-name()='name') or ((local-name(..)='Displacer' or nodeType='Displacer' or EPnodeType='Displacer' or @nodeType='Displacer') and local-name()='name') or ((local-name(..)='Humanoid' or nodeType='Humanoid' or EPnodeType='Humanoid' or @nodeType='Humanoid') and (local-name()='name' or local-name()='version'))" /> <xsl:variable name="HAnimMFStringTypes" select="((local-name(..)='Humanoid' or nodeType='Humanoid' or EPnodeType='Humanoid' or @nodeType='') and local-name()='info')" /> <xsl:variable name="DisJavaVrmlSFStringTypes" select="((local-name(..)='EspduTransform' or nodeType='EspduTransform' or EPnodeType='EspduTransform' or @nodeType='EspduTransform' or local-name(..)='ReceiverPdu' or nodeType='ReceiverPdu' or EPnodeType='ReceiverPdu' or @nodeType='ReceiverPdu' or local-name(..)='SignalPdu' or nodeType='SignalPdu' or EPnodeType='SignalPdu' or @nodeType='SignalPdu' or local-name(..)='TransmitterPdu' or nodeType='TransmitterPdu' or EPnodeType='TransmitterPdu' or @nodeType='TransmitterPdu') and (local-name()='marking' or local-name()='address' or local-name()='networkMode' or local-name()='multicastRelayHost' or local-name()='address'))" /> <!-- this step is necessary due to lack of MFBool/Booleans type in VRML 97 --> <xsl:variable name="LatticeXvlConversionFields" select="((local-name(..)='XvlShell' or nodeType='XvlShell' or EPnodeType='XvlShell' or @nodeType='XvlShell') and (local-name()='shellType'))" /> <xsl:variable name="tokenCount"> <xsl:call-template name="tokenCount"> <xsl:with-param name="parameter" select="."/> </xsl:call-template> </xsl:variable> <xsl:choose> <!-- take care of SFString fields by wrapping &quot; quotation marks &quot; --> <xsl:when test="((local-name(..)='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor') and local-name()='description') or ((local-name(..)='AudioClip' or nodeType='AudioClip' or EPnodeType='AudioClip' or @nodeType='AudioClip') and local-name()='description') or ((local-name(..)='Fog' or nodeType='Fog' or EPnodeType='Fog' or @nodeType='Fog') and local-name()='fogType') or ((local-name(..)='FontStyle' or nodeType='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle') and (local-name()='language' or local-name()='style')) or ((local-name(..)='Viewpoint' or nodeType='Viewpoint' or EPnodeType='Viewpoint' or @nodeType='Viewpoint') and local-name()='description') or ((local-name(..)='WorldInfo' or nodeType='WorldInfo' or EPnodeType='WorldInfo' or @nodeType='WorldInfo') and local-name()='title') or GeoSpatialSFStringTypes or HAnimSFStringTypes or DisJavaVrmlSFStringTypes or (nodeType = 'String') or (EPnodeType = 'String') or (EPfieldType = 'String') or (nodeType = 'Booleans') or (EPnodeType = 'Booleans') or (EPfieldType = 'Booleans') or (BooleansTypes) "> <xsl:if test="(local-name()='fogType' or local-name()='style') and (tokenCount > 1)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>illegal number of tokens (</xsl:text> <xsl:value-of select="tokenCount"/> <xsl:text>), maximum allowed = 1</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name(.)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:choose> <!-- output SFString. wrap quotes if string-length 0 --> <xsl:when test="not(.)"><xsl:text> &quot;&quot;&#10;</xsl:text></xsl:when> <!-- output SFString. no need to wrap quotes --> <xsl:when test="starts-with(normalize-space(.),'"')"> <xsl:text>&#10;</xsl:text></xsl:when> <xsl:when test='starts-with(.,"'")'> "<xsl:text>&quot;&#10;</xsl:text></xsl:when> <!-- output SFString with wrapped quotes since it doesn't have any--> <xsl:otherwise><xsl:value-of select="local-name()"/> "<xsl:text>&quot;&#10;</xsl:text></xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of some special MFString types by adding enclosing &quot; &quot; marks --> <xsl:when test="((local-name(..)='FontStyle' or nodeType='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle') and (local-name()='family' or local-name()='justify')) or ((local-name(..)='NavigationInfo' or nodeType='NavigationInfo' or EPnodeType='NavigationInfo' or @nodeType='NavigationInfo') and local-name()='type')"> <xsl:if test="(local-name()='justify') and (tokenCount > 2)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>illegal number of tokens (</xsl:text> <xsl:value-of select="tokenCount"/> <xsl:text>), maximum allowed = 2</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name(.)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:choose> <!-- output MFString. wrap quotes if string-length 0 --> <xsl:when test="not(.)"><xsl:text> [ &quot;&quot; ]&#10;</xsl:text></xsl:when> <!-- output MFString. don't modify quotes if some are there already --> <xsl:when test="contains(.,'"')"> [ <xsl:text> ] &#10;</xsl:text></xsl:when> <!--

quotes found... -->


<!-- output MFString with wrapped quotes around token values --> <xsl:otherwise> <xsl:value-of select="local-name()"/> <!-- <xsl:text>

inputString sent: &quot;</xsl:text><xsl:value-of select="concat(normalize-space(translate(.,'"',' ')),' ')"/><xsl:text>&quot;&#10;</xsl:text> -->


<xsl:text> [</xsl:text> <xsl:call-template name="wrap-quotes-around-tokens"> <xsl:with-param name="inputString" select="concat(normalize-space(translate(.,'"',' ')),' ')"/> </xsl:call-template> <xsl:text> ]&#10;</xsl:text> <!--

inserted quotes around tokens... -->


</xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of MFString types by wrapping [ ] (if necessary, ensure contained SFString elements wrapped overall in &quot; &quot;) --> <xsl:when test="((local-name(..)='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor') and (local-name()='parameter' or local-name()='url')) or ((local-name(..)='AudioClip' or nodeType='AudioClip' or EPnodeType='AudioClip' or @nodeType='AudioClip') and local-name()='url') or ((local-name(..)='Background' or nodeType='Background' or EPnodeType='Background' or @nodeType='Background') and contains(local-name(),'Url')) or ((local-name(..)='ImageTexture' or nodeType='ImageTexture' or EPnodeType='ImageTexture' or @nodeType='ImageTexture') and local-name()='url') or ((local-name(..)='Inline' or nodeType='Inline' or EPnodeType='Inline' or @nodeType='Inline') and local-name()='url') or ((local-name(..)='MovieTexture' or nodeType='MovieTexture' or EPnodeType='MovieTexture' or @nodeType='MovieTexture') and local-name()='url') or ((local-name(..)='Script' or nodeType='Script' or EPnodeType='Script' or @nodeType='Script') and local-name()='url') or ((local-name(..)='Text' or nodeType='Text' or EPnodeType='Text' or @nodeType='Text') and local-name()='string') or ((local-name(..)='WorldInfo' or nodeType='WorldInfo' or EPnodeType='WorldInfo' or @nodeType='WorldInfo') and local-name()='info') or GeoSpatialMFStringTypes or HAnimMFStringTypes or (nodeType = 'Strings') or (EPnodeType = 'Strings') or (EPfieldType = 'Strings')"> <xsl:choose> <!-- output MFString. wrap quotes if string-length 0 --> <xsl:when test="not(.)"><xsl:text> [ &quot;&quot; ]&#10;</xsl:text></xsl:when> <!-- output MFString. no need to wrap quotes --> <xsl:when test="starts-with(normalize-space(.),'"')"> [ <xsl:text> ]&#10;</xsl:text></xsl:when> <xsl:when test='starts-with(.,"'")'> [ "<xsl:text>&quot; ]&#10;</xsl:text></xsl:when> <!-- output MFString with wrapped quotes since it doesn't have any--> <xsl:otherwise><xsl:value-of select="local-name()"/> [ "<xsl:text>&quot; ]&#10;</xsl:text></xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of other MF field types by wrapping [ ] --> <xsl:when test="(contains(local-name(..),'Interpolator') and contains(local-name(),'key')) or ( local-name(..)='Background' or nodeType='Background' or EPnodeType='Background' or @nodeType='Background') or ((local-name(..)='ColorNode' or nodeType='ColorNode' or EPnodeType='ColorNode' or @nodeType='ColorNode' or local-name(..)='Color' or nodeType='Color' or EPnodeType='Color' or @nodeType='Color' ) and local-name()='color') or ((local-name(..)='Coordinate' or nodeType='Coordinate' or EPnodeType='Coordinate' or @nodeType='Coordinate') and local-name()='point') or ((local-name(..)='ElevationGrid' or nodeType='ElevationGrid' or EPnodeType='ElevationGrid' or @nodeType='ElevationGrid') and local-name()='height') or ((local-name(..)='Extrusion' or nodeType='Extrusion' or EPnodeType='Extrusion' or @nodeType='Extrusion') and (local-name()='crossSection' or local-name()='orientation' or local-name()='scale' or local-name()='spine')) or ((local-name(..)='IndexedFaceSet' or nodeType='IndexedFaceSet' or EPnodeType='IndexedFaceSet' or @nodeType='IndexedFaceSet') and contains(local-name(),'Index')) or ((local-name(..)='IndexedLineSet' or nodeType='IndexedLineSet' or EPnodeType='IndexedLineSet' or @nodeType='IndexedLineSet') and contains(local-name(),'Index')) or ((local-name(..)='LOD' or nodeType='LOD' or EPnodeType='LOD' or @nodeType='LOD') and local-name()='range') or ((local-name(..)='NavigationInfo' or nodeType='NavigationInfo' or EPnodeType='NavigationInfo' or @nodeType='NavigationInfo') and local-name()='avatarSize') or ((local-name(..)='Normal' or nodeType='Normal' or EPnodeType='Normal' or @nodeType='Normal') and local-name()='vector') or ((local-name(..)='Text' or nodeType='Text' or EPnodeType='Text' or @nodeType='Text') and local-name()='length') or ((local-name(..)='TextureCoordinate' or nodeType='TextureCoordinate' or EPnodeType='TextureCoordinate' or @nodeType='TextureCoordinate') and local-name()='point') or ExtensionMFtypes or MFtypes "> <!-- could put traps here to eliminate default-valued fields --> <!-- ?? is a local construct needed here to check and wrap quotes around individual string elements in MFString, if content didn't comply?? --> <xsl:value-of select="local-name()"/><xsl:text> [ </xsl:text> <xsl:value-of select="."/> <!-- watch out for illegal embedded VRML comments hiding ] bracket --> <xsl:if test="contains(.,'#')"><xsl:text>&#10;</xsl:text></xsl:if> <xsl:text> ]&#10;</xsl:text> </xsl:when> <!-- take care of LatticeXvl fields that require conversion --> <xsl:when test="LatticeXvlConversionFields"> <xsl:choose> <xsl:when test="local-name()='shellType'"> <!-- currently the only non-default choice is "POLYGON-MESH" (0). --> <xsl:value-of select="local-name()"/> <xsl:text> 0&#10;</xsl:text> </xsl:when> </xsl:choose> </xsl:when> <!-- take care of IDREF, IDREFS for node referrals --> <xsl:when test="((local-name(..)='GeoMetadata' or nodeType='GeoMetadata' or EPnodeType='GeoMetadata' or @nodeType='GeoMetadata') and local-name()='data') or (nodeType = 'Nodes') or (EPnodeType = 'Nodes') or (EPfieldType = 'Nodes') "> <!-- need to loop through each IDREF'ed node name, also add separate IDREF case --> <xsl:value-of select="local-name()"/> [ USE <xsl:text> ]&#10;</xsl:text> </xsl:when> <!-- take care of boolean value capitalization - watch out, no discrimination! --> <xsl:when test=".='true'"> <xsl:value-of select="local-name()"/><xsl:text> TRUE&#10;</xsl:text> </xsl:when> <xsl:when test=".='false'"> <xsl:value-of select="local-name()"/><xsl:text> FALSE&#10;</xsl:text> </xsl:when> <!-- default field output is merely standalone value(s), if there is an error it should be flagged --> <xsl:otherwise> <xsl:if test="."> <xsl:value-of select="local-name()"/> <xsl:text>&#10;</xsl:text></xsl:if> </xsl:otherwise> </xsl:choose> </xsl:if> <!-- attribute value validation - - - - - - - - - - - - - - - - - - - --> <!-- exclude String/Strings attributes before testing other attributes --> <xsl:if test="notDefaultValue and local-name()!='url' and not(contains(.,'Url')) and local-name()!='string' and local-name()!='appinfo' and local-name()!='documentation' and local-name()!='description' and not(local-name(..)='Anchor' and local-name()='parameter') and not(local-name(..)='FontStyle' and (local-name()='language')) and not(local-name(..)='WorldInfo' and (local-name()='info' or local-name()='title'))"> <!-- test for embedded vrml contents in attribute contents --> <xsl:if test="contains(.,'#')"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>embedded VRML comments (anything following a # symbol) may get mangled by XML and hide data! Recommendation: use separate XML comments, instead of error-prone VRML comments embedded in attribute fields.</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name(.)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:variable name="attributeName" select="local-name()"/> <xsl:variable name="parentElementName" select="local-name(..)"/> <xsl:variable name="prototypeName" select="../../@name"/> <xsl:variable name="fieldValueName" select="../@name"/> <xsl:variable name="normalizeSpaceValue"> <xsl:choose> <!-- GeoSpatial profile coordinates are encoded as String/Strings, need to become Doubles in future version --> <xsl:when test="starts-with(attributeName,'geo') or starts-with(parentElementName,'Geo')"> <xsl:value-of select="normalize-space(translate(.,',"',' '))"/> </xsl:when> <!-- remove commas, which are treated as whitespace in VRML attributes --> <xsl:otherwise> <xsl:value-of select="normalize-space(translate(.,',',' '))"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="blankedValue" select="concat(' ',normalizeSpaceValue,' ')"/> <xsl:variable name="nonSpaceValue" select="translate(normalizeSpaceValue,' ','')"/> <xsl:variable name="tupleCount" select="(string-length(normalizeSpaceValue) - string-length(nonSpaceValue)) + 1"/> <!-- debug <xsl:message> <xsl:text>attributeName=</xsl:text><xsl:value-of select="attributeName"/><xsl:text>, </xsl:text> <xsl:text>parentElementName=</xsl:text><xsl:value-of select="parentElementName"/><xsl:text>, </xsl:text> <xsl:text>prototypeName=</xsl:text><xsl:value-of select="prototypeName"/><xsl:text>, </xsl:text> <xsl:text>fieldValueName=</xsl:text><xsl:value-of select="fieldValueName"/><xsl:text>, </xsl:text> <xsl:text>tupleCount=</xsl:text><xsl:value-of select="tupleCount"/> </xsl:message> --> <xsl:choose> <!-- Boolean --> <xsl:when test=" (attributeName='ccw') or (attributeName='convex') or (attributeName='colorPerVertex') or (attributeName='enabled') or (attributeName='normalPerVertex') or (attributeName='on') or (attributeName='solid') or (parentElementName='AudioClip' and attributeName='loop') or (parentElementName='Collision' and attributeName='collide') or (parentElementName='Cone' and (attributeName='side' or attributeName='bottom')) or (parentElementName='Cylinder' and (attributeName='side' or attributeName='bottom' or attributeName='top')) or (parentElementName='CylinderSensor' and attributeName='autoOffset') or (parentElementName='Extrusion' and (attributeName='beginCap' or attributeName='endCap')) or (parentElementName='FontStyle' and (attributeName='horizontal' or attributeName='leftToRight' or attributeName='topToBottom')) or (parentElementName='ImageTexture' and (attributeName='repeatS' or attributeName='repeatT')) or (parentElementName='MovieTexture' and (attributeName='repeatS' or attributeName='repeatT' or attributeName='loop')) or (parentElementName='PixelTexture' and (attributeName='repeatS' or attributeName='repeatT')) or (parentElementName='NavigationInfo' and attributeName='headlight') or (parentElementName='PlaneSensor' and attributeName='autoOffset') or (parentElementName='SphereSensor' and attributeName='autoOffset') or (parentElementName='Script' and (attributeName='directOutput' or attributeName='mustEvaluate')) or (parentElementName='Sound' and attributeName='spatialize') or (parentElementName='TimeSensor' and attributeName='loop') or (contains(parentElementName,'Viewpoint') and attributeName='jump') or (parentElementName='GeoInline' and attributeName='load') or (parentElementName='GeoOrigin' and attributeName='rotateYUp') or (parentElementName='GeoViewpoint' and attributeName='headlight')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Boolean</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- Booleans: no native Booleans attributes but Scripts, prototypes and Lattice XvlShell can have them. Maybe BooleanSequencer someday. --> <xsl:when test="(local-name(..)='XvlShell' and (local-name()='faceEmpty' or local-name()='faceHidden'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Booleans</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- Enumerations --> <xsl:when test=" (parentElementName='Fog' and attributeName='fogType') or (parentElementName='FontStyle' and (attributeName='family' or attributeName='justify' or attributeName='style')) or (parentElementName='NavigationInfo' and contains(attributeName,'type')) or (starts-with(parentElementName,'Geo') and attributeName='geoSystem') or (parentElementName='GeoViewpoint' and contains(attributeName,'navType'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>String</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <xsl:if test="contains(normalizeSpaceValue,'"')"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> does not require "quotation" marks</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- better tests needed for exact checks, but this will flag major differences --> <xsl:choose> <xsl:when test="(parentElementName='Fog' and attributeName='fogType')"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'LINEAREXPONENTIAL"','')"/> <xsl:if test="normalize-space(attributeResidue)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by standard (LINEAR EXPONENTIAL)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(parentElementName='FontStyle' and attributeName='family')"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'SERIFSANSTYPEWRITER"','')"/> <xsl:if test="normalize-space(attributeResidue)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by standard (SERIF SANS TYPEWRITER)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(parentElementName='FontStyle' and attributeName='justify')"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'FIRSTBEGINMIDDLEEND"','')"/> <xsl:if test="normalize-space(attributeResidue)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by standard (FIRST BEGIN MIDDLE END)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:if test="tupleCount > 2"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains too many values (max 2)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(parentElementName='FontStyle' and attributeName='style')"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'PLAINBOLDITALICBOLDITALIC"','')"/> <xsl:if test="normalize-space(attributeResidue)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by standard (PLAIN BOLD ITALIC BOLDITALIC)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:if test="tupleCount > 1"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains too many values (max 1)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(parentElementName='NavigationInfo' and contains(attributeName,'type')) or (parentElementName='GeoViewpoint' and contains(attributeName,'navType'))"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'EXAMINEWALKFLYANY"','')"/> <xsl:if test="normalize-space(attributeResidue)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by standard (EXAMINE WALK FLY ANY)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(parentElementName='EspduTransform' and (attributeName='networkMode'))"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'EXAMINEWALKFLYANY"','')"/> <xsl:if test="(normalizeSpaceValue!='local') and (normalizeSpaceValue!='remote') and (normalizeSpaceValue!='master')"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by standard (local master remote)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(starts-with(parentElementName,'Geo' and attributeName='geoSystem'))"> <xsl:variable name="attributeResidue" select="translate(normalizeSpaceValue,'GDCUTMGCC"','')"/> <xsl:if test="normalize-space(attributeResidue)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Enumeration attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains values unrecognized by GeoVrml standard (GDC UTM GCC)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> </xsl:choose> </xsl:when> <!-- Color --> <xsl:when test=" (contains(parentElementName,'Light') and attributeName='color') or (parentElementName='Fog' and attributeName='color') or (parentElementName='Material' and contains(attributeName,'Color'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Color</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- Colors --> <xsl:when test=" (parentElementName='Color' and attributeName='color') or (parentElementName='ColorNode' and attributeName='color') or (parentElementName='ColorInterpolator' and attributeName='keyValue') or (parentElementName='Background' and (attributeName='groundColor' or attributeName='skyColor'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Colors</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- Integer --> <xsl:when test=" (parentElementName='Switch' and attributeName='whichChoice') or (contains(parentElementName,'ElevationGrid') and (attributeName='xDimension' or attributeName='zDimension')) or (parentElementName='XvlShell' and attributeName='numberOfDivisions')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Integer</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- watch out for less-than operator inside numeric comparisons --> <!-- value range [-1 .. infinity] --> <xsl:if test="(local-name(..)='Switch' and local-name()='whichChoice') and (-1 > number(.))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> outside valid range [-1 .. +infinity]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:choose> <!-- test sufficient children for Switch range --> <xsl:when test="(local-name(..)='Switch' and local-name()='whichChoice') and not(../*) and not((.='-1') or (.=''))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> found without any Switch child levels</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="(local-name(..)='Switch' and local-name()='whichChoice') and ((number(.) + 1) > count(../*))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must not be greater than number of Switch child levels (initial index = 0)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> <!-- value range [0 .. infinity] --> <xsl:if test="(local-name(..)='ElevationGrid') and (contains(blankedValue,' -'))"> <!-- exclude negative exponents --> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> outside valid range [0 .. +infinity]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- Integers --> <xsl:when test=" (attributeName='colorIndex') or (attributeName='coordIndex') or (attributeName='normalIndex') or (attributeName='texCoordIndex') or (attributeName='faceCoordIndex') or (attributeName='faceTexCoordIndex') or (attributeName='edgeBeginCoordIndex') or (attributeName='edgeEndCoordIndex')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Integers</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- value range [-1 .. infinity] applies to all four Index attributes --> <xsl:if test="(-1 > number(.))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> outside valid range [-1 .. +infinity]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- Float --> <xsl:when test=" (attributeName='ambientIntensity') or (attributeName='intensity') or (attributeName='creaseAngle') or (parentElementName='AudioClip' and attributeName='pitch') or (parentElementName='Cone' and (attributeName='bottomRadius' or attributeName='height')) or (parentElementName='Cylinder' and (attributeName='radius' or attributeName='height')) or (parentElementName='CylinderSensor' and (attributeName='diskAngle' or attributeName='maxAngle' or attributeName='minAngle' or attributeName='offset')) or (contains(parentElementName,'ElevationGrid') and (attributeName='xSpacing' or attributeName='zSpacing')) or (parentElementName='Fog' and attributeName='visibilityRange') or (parentElementName='FontStyle' and (attributeName='size' or attributeName='spacing')) or (parentElementName='Material' and (attributeName='ambientIntensity' or attributeName='shininess' or attributeName='transparency')) or (parentElementName='MovieTexture' and attributeName='speed') or (parentElementName='NavigationInfo' and (attributeName='speed' or attributeName='visibilityLimit')) or (parentElementName='GeoViewpoint' and attributeName='speed') or (parentElementName='PointLight' and attributeName='radius') or (parentElementName='SpotLight' and (attributeName='radius' or attributeName='cutOffAngle' or attributeName='beamWidth') or (parentElementName='Sound' and (attributeName='maxBack' or attributeName='minBack' or attributeName='maxFront' or attributeName='minFront') or attributeName='priority')) or (parentElementName='Sphere' and attributeName='radius') or (parentElementName='Text' and attributeName='maxExtent') or (parentElementName='TextureTransform' and attributeName='rotation') or (contains(parentElementName,'Viewpoint') and attributeName='fieldOfView') or (parentElementName='Segment' and attributeName='mass')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Float</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- further range checks are only performed for native nodes, since prototypes might extend functionality --> <xsl:choose> <!-- value range [0 .. 1] --> <xsl:when test="((attributeName='intensity') or contains(attributeName,'Intensity') or (parentElementName='Material' and (attributeName='shininess' or attributeName='transparency')) or (parentElementName='Sound' and attributeName='priority')) and ((number(.) > 1) or (0 > number(.)))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> outside valid range [0..1]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- test nonnegative attributes --> <xsl:when test="((local-name()='creaseAngle') or (local-name(..)='Fog' and local-name()='visibilityRange') or (local-name(..)='FontStyle' and (local-name()='size' or local-name()='spacing')) or (local-name(..)='NavigationInfo' and (local-name()='speed' or local-name()='visibilityLimit')) or (local-name(..)='PixelTexture' and local-name()='image') or (local-name(..)='PointLight' and (local-name()='radius')) or (local-name(..)='SpotLight' and (local-name()='radius')) or (local-name(..)='ProximitySensor' and local-name()='size') or (local-name(..)='VisibilitySensor' and local-name()='size') or (local-name(..)='Sound' and (starts-with(local-name(),'max') or starts-with(local-name(),'min'))) or (local-name(..)='Text' and local-name()='maxExtent') or (parentElementName='Segment' and attributeName='mass')) and (contains(blankedValue,' -'))"> <!-- exclude negative exponents --> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be a nonnegative value</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- test positive attributes --> <xsl:when test="((local-name(..)='AudioClip' and local-name()='pitch') or (local-name(..)='Box' and local-name()='size') or (local-name(..)='Cone' and (local-name()='bottomRadius' or local-name()='height')) or (local-name(..)='Cylinder' and (local-name()='height' or local-name()='radius')) or (local-name(..)='Sphere' and local-name()='radius') or (local-name(..)='TimeSensor' and local-name()='cycleInterval')) and (contains(blankedValue,' -') or normalize-space(.)='0' or normalize-space(.)='0.0' or normalize-space(.)='.0' or normalize-space(.)='0.')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be a positive value</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- range [-2pi..2pi] --> <xsl:when test="((local-name(..)='CylinderSensor' and (local-name()='maxAngle' or local-name()='minAngle')) and ((number(.) > 6.283185306) or (-6.283185306 > number(.))))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be within range [-2pi..2pi] radians</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- range (0..pi/2) --> <xsl:when test="((local-name(..)='CylinderSensor' and (local-name()='diskAngle')) and ((number(.) > 1.5707963265) or (0 > number(.))))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be within range (0..pi/2) radians</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:when> <!-- Floats --> <xsl:when test=" (attributeName='key') or (contains(parentElementName,'ElevationGrid') and attributeName='height') or (contains(parentElementName,'LOD') and attributeName='range') or (parentElementName='NavigationInfo' and attributeName='avatarSize') or (parentElementName='Text' and attributeName='length') or (parentElementName='Background' and (attributeName='groundAngle' or attributeName='skyAngle')) or (parentElementName='Joint' and (attributeName='llimit' or attributeName='ulimit' or attributeName='stiffness')) or (parentElementName='Segment' and attributeName='momentsOfInertia') or (parentElementName='XvlShell' and (attributeName='vertexRound' or attributeName='edgeRound'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Floats</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <xsl:choose> <!-- test nonnegative attributes --> <xsl:when test="((local-name(..)='NavigationInfo' and local-name()='avatarSize') or (local-name(..)='Text' and local-name()='length')) and (contains(blankedValue,' -'))"> <!-- exclude negative exponents --> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be a nonnegative value</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- test positive attributes --> <xsl:when test="(local-name(..)='LOD' and local-name()='range') and ((contains(blankedValue,' -') or contains(blankedValue,' 0 ') or contains(blankedValue,' 0.0 ') or contains(blankedValue,' 0. ') or contains(blankedValue,' .0 ')))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be all positive (nonzero) values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- test sufficient children for LOD range --> <xsl:when test="(local-name(..)='LOD' and local-name()='range') and not(../*)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> found without any LOD child levels</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="(local-name(..)='LOD' and local-name()='range') and (tupleCount + 1 != (count(../*)))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> array length (</xsl:text> <xsl:value-of select="tupleCount"/> <xsl:text>) must be one greater than number of LOD child levels (</xsl:text> <xsl:value-of select="count(../*)"/> <xsl:text>)</xsl:text> <xsl:if test="(tupleCount = count(../*))"> <xsl:text> (hint: can use empty WorldInfo as nonrendering final node)</xsl:text> </xsl:if> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- momentsOfInertia size --> <xsl:when test="(parentElementName='Segment' and attributeName='momentsOfInertia') and (tupleCount!=9)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> is a [3 x 3] matrix and must contain 9 values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- key with no keyValue --> <xsl:when test="(local-name(.)='key') and not(normalize-space(../@keyValue))"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> needs corresponding keyValue attribute</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- test key/keyValue size matches --> <xsl:when test="(local-name(.)='key')"> <!-- change commas and quote marks to spaces, then normalize --> <xsl:variable name="keyValue" select="normalize-space(translate(../@keyValue,',"',' '))"/> <xsl:variable name="keyValueTokensCount" select="(string-length(keyValue) - string-length(translate(keyValue,' ',''))) + 1"/> <xsl:variable name="keyValueCount"> <xsl:choose> <xsl:when test="(local-name(..)='ScalarInterpolator')"> <xsl:value-of select="keyValueTokensCount"/> </xsl:when> <xsl:when test="(local-name(..)='ColorInterpolator') or (local-name(..)='CoordinateInterpolator') or (local-name(..)='NormalInterpolator') or (local-name(..)='PositionInterpolator') or (local-name(..)='GeoPositionInterpolator')"> <xsl:value-of select="keyValueTokensCount div 3"/> </xsl:when> <xsl:when test="(local-name(..)='OrientationInterpolator')"> <xsl:value-of select="keyValueTokensCount div 4"/> </xsl:when> </xsl:choose> </xsl:variable> <!-- debug <xsl:message> <xsl:text>keyValue=</xsl:text><xsl:value-of select="keyValue"/><xsl:text>, </xsl:text> <xsl:text>keyValueTokensCount=</xsl:text><xsl:value-of select="keyValueTokensCount"/><xsl:text>, </xsl:text> <xsl:text>keyValueCount=</xsl:text><xsl:value-of select="keyValueCount"/> </xsl:message> --> <xsl:choose> <xsl:when test="(local-name(..)='CoordinateInterpolator') or (local-name(..)='NormalInterpolator')"> <xsl:if test="(keyValueCount div tupleCount)!=round(keyValueCount div tupleCount)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> key count (</xsl:text> <xsl:value-of select="tupleCount"/> <xsl:text>) must be an integer factor of the keyValue count (</xsl:text> <xsl:value-of select="keyValueCount"/> <xsl:text>) to determine number of Vector3Floats sent in each eventOut value</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="(tupleCount!=keyValueCount)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> key count (</xsl:text> <xsl:value-of select="tupleCount"/> <xsl:text>) must equal keyValue count (</xsl:text> <xsl:value-of select="keyValueCount"/> <xsl:text>)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:when> <!-- more precise angle tests needed, but these help catch gross cases (e.g. degree values) --> <!-- range [0..pi/2] --> <xsl:when test="((local-name(..)='Background' and local-name()='groundAngle')) and (contains(blankedValue,' -') or contains(blankedValue,' 2') or contains(blankedValue,' 3') or contains(blankedValue,' 4') or contains(blankedValue,' 5') or contains(blankedValue,' 6') or contains(blankedValue,' 7') or contains(blankedValue,' 8') or contains(blankedValue,' 9'))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be in range [0..pi/2] radians</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- range [0..pi] --> <xsl:when test="((local-name(..)='Background' and local-name()='skyAngle')) and (contains(blankedValue,' -') or contains(blankedValue,' 4') or contains(blankedValue,' 5') or contains(blankedValue,' 6') or contains(blankedValue,' 7') or contains(blankedValue,' 8') or contains(blankedValue,' 9'))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be in range [0..pi] radians</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:when> <!-- Vector2Float --> <xsl:when test=" (parentElementName='TextureTransform' and (attributeName='center' or attributeName='scale' or attributeName='translation')) or (parentElementName='PlaneSensor' and (attributeName='maxPosition' or attributeName='minPosition'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Vector2Float</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- no constraint tests needed --> </xsl:when> <!-- Vector2FloatArray --> <xsl:when test=" (parentElementName='Extrusion' and (attributeName='crossSection' or attributeName='scale')) or (parentElementName='TextureCoordinate' and attributeName='point')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Vector2FloatArray</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- test positive attributes --> <xsl:if test="( (parentElementName='Extrusion' and attributeName='scale')) and ((contains(blankedValue,' -') or contains(blankedValue,' 0 ') or contains(blankedValue,' 0.0 ') or contains(blankedValue,' .0 ') or contains(blankedValue,' 0. ')))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must be all positive (nonzero) values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- Extrusion spine has a default value, so don't need to check for it --> <!-- test scale/spine size matches --> <xsl:if test="parentElementName='Extrusion' and attributeName='scale'"> <!-- change commas to spaces and normalize --> <xsl:variable name="spine" select="normalize-space(translate(../@spine,',',' '))"/> <xsl:variable name="spineTokensCount" select="(string-length(spine) - string-length(translate(spine,' ',''))) + 1"/> <xsl:variable name="spineCount" select="spineTokensCount div 3"/> <!-- debug <xsl:message> <xsl:text>spine=</xsl:text><xsl:value-of select="spine"/><xsl:text>, </xsl:text> <xsl:text>spineTokensCount=</xsl:text><xsl:value-of select="spineTokensCount"/><xsl:text>, </xsl:text> <xsl:text>spineCount=</xsl:text><xsl:value-of select="spineCount"/> </xsl:message> --> <xsl:if test="((tupleCount div 2)!=spineCount) and not((spine='' or spine=' ') and (tupleCount div 2)=2)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> count (</xsl:text> <xsl:value-of select="(tupleCount div 2)"/> <xsl:text>) must equal spine count (</xsl:text> <xsl:choose> <xsl:when test="not(../@spine)"><xsl:text>default=2</xsl:text></xsl:when> <xsl:otherwise><xsl:value-of select="spineCount"/></xsl:otherwise> </xsl:choose> <xsl:text>)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:if> </xsl:when> <!-- Vector3Float --> <xsl:when test=" (attributeName='bboxCenter') or (attributeName='bboxSize') or (parentElementName='Billboard' and attributeName='axisOfRotation') or (parentElementName='Box' and attributeName='size') or (parentElementName='DirectionalLight' and attributeName='direction') or (contains(parentElementName,'LOD') and attributeName='center') or (parentElementName='PlaneSensor' and attributeName='offset') or (parentElementName='ProximitySensor' and (attributeName='center' or attributeName='size')) or (parentElementName='PointLight' and (attributeName='attenuation' or attributeName='location')) or (parentElementName='Sound' and (attributeName='direction' or attributeName='location')) or (parentElementName='SpotLight' and (attributeName='attenuation' or attributeName='direction' or attributeName='location')) or (parentElementName='Transform' and (attributeName='center' or attributeName='scale' or attributeName='translation')) or (parentElementName='Viewpoint' and attributeName='position') or (parentElementName='VisibilitySensor' and attributeName='size') or (parentElementName='Joint' and (attributeName='center' or attributeName='scale' or attributeName='translation')) or (parentElementName='Site' and (attributeName='center' or attributeName='scale' or attributeName='translation')) or (parentElementName='Segment' and attributeName='centerOfMass')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Vector3Float</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- check coverage of other attributes --> <xsl:choose> <!-- positive value --> <xsl:when test="((parentElementName='Box' and attributeName='size') or (parentElementName='ProximitySensor' and attributeName='size') or (parentElementName='Transform' and attributeName='scale')) and ((contains(blankedValue,' -') or contains(blankedValue,' 0 ') or contains(blankedValue,' 0.0 ') or contains(blankedValue,' .0 ') or contains(blankedValue,' 0. ')))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain all positive (nonzero) values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- value range [0 .. infinity] --> <xsl:when test="((parentElementName='PointLight' and attributeName='attenuation') or (parentElementName='SpotLight' and attributeName='attenuation') or (parentElementName='VisibilitySensor' and attributeName='size')) and (contains(blankedValue,' -'))"> <!-- exclude negative exponents --> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> outside valid range [0 .. +infinity]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- bboxSize values positive or '-1 -1 -1' --> <xsl:when test="(local-name()='bboxSize') and (contains(blankedValue,' -') and (normalize-space(translate(.,'.0',''))!='-1 -1 -1'))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains negative value other than '-1 -1 -1'</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:when> <!-- Vector3FloatArray --> <xsl:when test=" (parentElementName='CoordinateInterpolator' and attributeName='keyValue') or (parentElementName='NormalInterpolator' and attributeName='keyValue') or (parentElementName='PositionInterpolator' and attributeName='keyValue') or (contains(parentElementName,'Coordinate') and attributeName='point') or (parentElementName='GeoLocation' and attributeName='geoCoords') or (parentElementName='GeoOrigin' and attributeName='geoCoords') or (parentElementName='Extrusion' and attributeName='spine') or (parentElementName='Normal' and attributeName='vector') or (parentElementName='Displacer' and attributeName='displacements') or (parentElementName='XvlShell' and (attributeName='edgeBeginVector' or attributeName='edgeEndVector'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Vector3FloatArray</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- Rotation --> <xsl:when test=" (parentElementName='SphereSensor' and attributeName='offset') or (parentElementName='Transform' and (attributeName='rotation' or attributeName='scaleOrientation')) or (contains(parentElementName,'Viewpoint') and attributeName='orientation') or (parentElementName='Joint' and (attributeName='limitOrientation' or attributeName='rotation' or attributeName='scaleOrientation')) or (parentElementName='Site' and (attributeName='rotation' or attributeName='scaleOrientation'))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Rotation</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- Rotations --> <xsl:when test=" (parentElementName='Extrusion' and attributeName='orientation') or (parentElementName='OrientationInterpolator' and attributeName='keyValue')"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Rotations</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <!-- Extrusion spine has a default value, so don't need to check for it --> <!-- test orientation/spine size matches --> <xsl:if test="parentElementName='Extrusion' and attributeName='orientation'"> <!-- change commas to spaces and normalize --> <xsl:variable name="spine" select="normalize-space(translate(../@spine,',',' '))"/> <xsl:variable name="spineTokensCount" select="(string-length(spine) - string-length(translate(spine,' ',''))) + 1"/> <xsl:variable name="spineCount" select="spineTokensCount div 3"/> <!-- debug <xsl:message> <xsl:text>spine=</xsl:text><xsl:value-of select="spine"/><xsl:text>, </xsl:text> <xsl:text>spineTokensCount=</xsl:text><xsl:value-of select="spineTokensCount"/><xsl:text>, </xsl:text> <xsl:text>spineCount=</xsl:text><xsl:value-of select="spineCount"/> </xsl:message> --> <xsl:if test="((tupleCount div 4)!=spineCount) and not((spine='' or spine=' ') and (tupleCount div 4)=2)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> count (</xsl:text> <xsl:value-of select="(tupleCount div 4)"/> <xsl:text>) must equal spine count (</xsl:text> <xsl:choose> <xsl:when test="not(../@spine)"><xsl:text>default=2</xsl:text></xsl:when> <xsl:otherwise><xsl:value-of select="spineCount"/></xsl:otherwise> </xsl:choose> <xsl:text>)</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:if> </xsl:when> <!-- Other <xsl:when test=" (attributeName='') or (parentElementName='' and attributeName='') or (parentElementName='' and attributeName='') or (parentElementName='' and (attributeName='' or attributeName='')) or (parentElementName='' and (attributeName='' or attributeName=''))"> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"><xsl:text>Boolean</xsl:text></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> --> </xsl:choose> <xsl:if test="(attributeName='keyValue') and not(normalize-space(translate(../@key,',',' ')))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(.),1,100)"/><xsl:text>'</xsl:text> <xsl:text> needs corresponding same-size key array</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:if> </xsl:template> <!-- ****** XML comments ****** --> <xsl:template match="comment()[ancestor::X3D]"> <!-- template match constraint [ancestor::X3D] filters out DTD comments --> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:call-template name="print-indent"></xsl:call-template> <!-- having trouble translating line breaks properly, changing them to spaces (which avoids runtime errors, at least). also meta tag. --> <xsl:text># </xsl:text><xsl:value-of select="normalize-space(.)"/> <!-- translate(.,'&#10;',' ') --> <xsl:if test="not(local-name(..)='field')"> <xsl:text>&#10;</xsl:text> </xsl:if> </xsl:template> <!-- ****** XML processing instructions ****** --> <xsl:template match="processing-instruction()"> <xsl:text># </xsl:text><xsl:value-of select="."/><xsl:text>&#10;</xsl:text> </xsl:template> <!-- ****** @appInfo for tooltips: comment the attribute value ****** --> <xsl:template match="@appInfo[local-name(..)='field' or local-name(..)='ProtoDeclare' or local-name(..)='ExternProtoDeclare']"> <xsl:param name="indent"><xsl:text>1</xsl:text></xsl:param> <xsl:if test="normalize-space(.)"> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text># [</xsl:text> <xsl:value-of select="local-name(.)"/> <xsl:text>] </xsl:text> <xsl:value-of select="translate(.,' ',' ')"/> </xsl:if> </xsl:template> <!-- ****** @documentation for tooltips: comment the attribute value ****** --> <xsl:template match="@documentation[local-name(..)='field' or local-name(..)='ProtoDeclare' or local-name(..)='ExternProtoDeclare']"> <xsl:if test="normalize-space(.)"> <xsl:text> # </xsl:text> <xsl:value-of select="local-name(.)"/> <xsl:text>: </xsl:text> <xsl:value-of select="translate(.,' ',' ')"/> <!-- check for url (or . in filename.ext) --> <xsl:if test="not(contains(.,'://')) and not(contains(.,'.'))"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>documentation attribute usually contains url of reference document.</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:choose> <xsl:when test="local-name(..)='field'"> <xsl:value-of select="local-name(../..)"/> <xsl:text> </xsl:text> <xsl:value-of select="../../@name"/> <xsl:text>, </xsl:text> <xsl:value-of select="local-name(..)"/> <xsl:text> </xsl:text> <xsl:value-of select="../@name"/> <xsl:text>, attribute </xsl:text> <xsl:value-of select="local-name(.)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="local-name(..)"/> <xsl:text> </xsl:text> <xsl:value-of select="../@name"/> <xsl:text>, attribute </xsl:text> <xsl:value-of select="local-name(.)"/> </xsl:otherwise> </xsl:choose> </xsl:with-param> <xsl:with-param name="DEF"/> </xsl:call-template> </xsl:if> </xsl:if> </xsl:template> <!-- ****** ROUTE ****** --> <xsl:template match="ROUTE"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>ROUTE </xsl:text> <xsl:value-of select="@fromNode" /><xsl:text>.</xsl:text> <xsl:value-of select="@fromField"/><xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /><xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> <xsl:text>&#10;</xsl:text> <xsl:variable name="fromNode" select="@fromNode" /> <xsl:variable name="fromField" select="@fromField" /> <xsl:variable name="toNode" select="@toNode" /> <xsl:variable name="toField" select="@toField" /> <xsl:choose> <!-- verify all parameters defined (which is convenient but redundant, since already required by DTD/Schema --> <xsl:when test="not(@fromNode) or not(@fromField) or not(@toNode) or not(@toField)"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>incomplete ROUTE </xsl:text> <xsl:choose> <xsl:when test="@fromNode"> <xsl:value-of select="@fromNode" /> </xsl:when> <xsl:otherwise><xsl:text>___</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="@fromField"> <xsl:value-of select="@fromField" /> </xsl:when> <xsl:otherwise><xsl:text>___</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text> TO </xsl:text> <xsl:choose> <xsl:when test="@toNode"> <xsl:value-of select="@toNode" /> </xsl:when> <xsl:otherwise><xsl:text>___</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text>.</xsl:text> <xsl:choose> <xsl:when test="@toField"> <xsl:value-of select="@toField" /> </xsl:when> <xsl:otherwise><xsl:text>___</xsl:text></xsl:otherwise> </xsl:choose> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:when> <!-- all ROUTE attributes defined, so check them --> <xsl:otherwise> <!-- duplicate ROUTEs? --> <xsl:if test="count(//ROUTE[(@fromNode=fromNode) and (@fromField=fromField) and (@toNode=toNode) and (@toField=toField)]) != 1"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>duplicate ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTEs</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> <!-- fromNode DEFed? --> <xsl:if test="not(//*[(@DEF=fromNode)])"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>no node with DEF="</xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>" found, for ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> <!-- toNode DEFed? --> <xsl:if test="not(//*[(@DEF=toNode)])"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>no node with DEF="</xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>" found, for ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> <!-- ROUTE within/without scope of ProtoDeclare? multiple checks follow. --> <!-- ROUTE inside ProtoDeclare but fromNode is not? --> <xsl:if test="ancestor-or-self::*[(local-name()='ProtoDeclare')] and not(ancestor-or-self::*[(local-name()='ProtoDeclare')]//*[@DEF=fromNode])"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>ROUTE inside ProtoDeclare "</xsl:text> <xsl:value-of select="ancestor-or-self::*[(local-name()='ProtoDeclare')]/@name" /> <xsl:text>" but fromNode "</xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>" is not inside same scope, for ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> <!-- ROUTE inside ProtoDeclare but toNode is not? --> <xsl:if test="ancestor-or-self::*[(local-name()='ProtoDeclare')] and not(ancestor-or-self::*[(local-name()='ProtoDeclare')]//*[@DEF=toNode])"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>ROUTE inside ProtoDeclare "</xsl:text> <xsl:value-of select="ancestor-or-self::*[(local-name()='ProtoDeclare')]/@name" /> <xsl:text>" but toNode "</xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>" is not inside same scope, for ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> <!-- ROUTE not inside ProtoDeclare but fromNode is? --> <xsl:if test="not(ancestor-or-self::*[(local-name()='ProtoDeclare')]) and (//*[(local-name()='ProtoDeclare')]//*[@DEF=fromNode])"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>ROUTE outside ProtoDeclare scope but fromNode "</xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>" is inside ProtoDeclare scope, for ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> <!-- ROUTE not inside ProtoDeclare but toNode is? --> <xsl:if test="not(ancestor-or-self::*[(local-name()='ProtoDeclare')]) and (//*[(local-name()='ProtoDeclare')]//*[@DEF=toNode])"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>ROUTE outside ProtoDeclare scope but toNode "</xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>" is inside ProtoDeclare scope, for ROUTE </xsl:text> <xsl:value-of select="@fromNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@fromField" /> <xsl:text> TO </xsl:text> <xsl:value-of select="@toNode" /> <xsl:text>.</xsl:text> <xsl:value-of select="@toField" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ROUTE</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- ****** fieldValue overrides default field values inside a ProtoInstance ****** --> <xsl:template match="fieldValue"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:call-template name="print-indent"></xsl:call-template> <xsl:value-of select="@name"/><xsl:text> </xsl:text> <xsl:variable name="fieldName" select="@name" /> <xsl:variable name="nodeTypeHint" select="../@nodeType" /> <!-- <xsl:text> # fieldName </xsl:text><xsl:value-of select="fieldName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # nodeTypeHint </xsl:text><xsl:value-of select="nodeTypeHint"/><xsl:text>&#10;</xsl:text> --> <!-- figure out node type for ProtoDeclared ProtoInstance, ExternProtoDeclared ProtoInstance and internal DTD declaration tag definitions --> <xsl:variable name="nodeName" select="../@name" /> <xsl:variable name="nodeName2" select="local-name(..)" /> <!-- ProtoDeclared ProtoInstance --> <xsl:variable name="nodeType" select="//ProtoDeclare[@name=nodeName or @name=nodeName2]/field[@name=fieldName]/@type" /> <!-- ExternProtoDeclared ProtoInstance --> <xsl:variable name="EPnodeType" select="//ExternProtoDeclare[@name=nodeName or @name=nodeName2]/field[@name=fieldName]/@type" /> <!-- debug diagnosis statements --> <!-- <xsl:text># fieldName </xsl:text><xsl:value-of select="fieldName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeName </xsl:text><xsl:value-of select="nodeName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeName2 </xsl:text><xsl:value-of select="nodeName2"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># nodeType </xsl:text><xsl:value-of select="nodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># EPnodeType </xsl:text><xsl:value-of select="EPnodeType"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># @nodeType </xsl:text><xsl:value-of select="@nodeType"/><xsl:text>&#10;</xsl:text> --> <xsl:variable name="fieldValueType"> <xsl:choose> <xsl:when test="nodeType"></xsl:when> <xsl:when test="EPnodeType"></xsl:when> </xsl:choose> </xsl:variable> <!-- <xsl:message><xsl:text>fieldValueType=</xsl:text><xsl:value-of select="fieldValueType"/></xsl:message> --> <!-- validate attribute values --> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> <xsl:choose> <!-- overload check --> <xsl:when test="@value and *"> <xsl:value-of select="@value" /> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>ignoring contained Node/Nodes content inside fieldValue </xsl:text> <xsl:value-of select="fieldName" /> <xsl:text>, since simple-type value="</xsl:text> <xsl:value-of select="@value" /> <xsl:text>" provided</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- if value is provided for Node types, then it should be a USEname --> <xsl:when test="@value and (../@nodeType or //*[local-name()='ProtoDeclare']/field[@name=fieldName and (@type='Node' or @type='Nodes')])"> <xsl:text> USE </xsl:text><xsl:value-of select="@value" /><xsl:text>&#10;</xsl:text> </xsl:when> <!-- Node/Nodes initializations: recurse on children/comments --> <!-- MFNode --> <xsl:when test="not(@value) and (count(*)>1)"> <xsl:text> [&#10;</xsl:text> <xsl:apply-templates select="*"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:text> ]&#10;</xsl:text> </xsl:when> <!-- SFNode --> <xsl:when test="(not(@value) and count(*)=1) or comment()"> <xsl:text> </xsl:text> <xsl:apply-templates select="* | comment()"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <!-- simple-type values --> <xsl:when test="@value"> <xsl:variable name="MFtypes" select="(nodeType ='Booleans') or (nodeType ='Colors') or (nodeType ='Floats') or (nodeType ='Integers') or (nodeType ='Rotations') or (nodeType ='Times') or (nodeType ='Vector2FloatArray') or (nodeType ='Vector3FloatArray') or (EPnodeType='Booleans') or (EPnodeType='Colors') or (EPnodeType='Floats') or (EPnodeType='Integers') or (EPnodeType='Rotations') or (EPnodeType='Times') or (EPnodeType='Vector2FloatArray') or (EPnodeType='Vector3FloatArray') or ((local-name(..)='Joint' or nodeType='Joint' or EPnodeType='Joint' or @nodeType='Joint') and (local-name()='skinCoordIndex' or local-name()='skinCoordWeight'))" /> <xsl:variable name="DisJavaVrmlBooleanTypes" select="((nodeName='EspduTransform' or nodeName2='EspduTransform' or nodeName='ReceiverPdu' or nodeName2='ReceiverPdu' or nodeName='SignalPdu' or nodeName2='SignalPdu' or nodeName='TransmitterPdu' or nodeName2='TransmitterPdu') and (fieldName='traceJava' or fieldName='rtpHeaderExpected'))" /> <!-- <xsl:text># MFtypes </xsl:text><xsl:value-of select="MFtypes"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text># DisJavaVrmlBooleanTypes </xsl:text><xsl:value-of select="DisJavaVrmlBooleanTypes"/><xsl:text>&#10;</xsl:text> --> <xsl:choose> <!-- take care of boolean value capitalization --> <xsl:when test="((nodeType ='Boolean') or (EPnodeType='Boolean') or (DisJavaVrmlBooleanTypes='true')) and @value='true'"> <xsl:text> TRUE&#10;</xsl:text> </xsl:when> <xsl:when test="((nodeType ='Boolean') or (EPnodeType='Boolean') or (DisJavaVrmlBooleanTypes='true')) and @value='false'"> <xsl:text> FALSE&#10;</xsl:text> </xsl:when> <!-- take care of SFString fields by wrapping &quot; quotation marks &quot; --> <xsl:when test="((local-name(..)='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor') and local-name()='description') or ((local-name(..)='AudioClip' or nodeType='AudioClip' or EPnodeType='AudioClip' or @nodeType='AudioClip') and local-name()='description') or ((local-name(..)='Fog' or nodeType='Fog' or EPnodeType='Fog' or @nodeType='Fog') and local-name()='fogType') or ((local-name(..)='FontStyle' or nodeType='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle') and (local-name()='language' or local-name()='style')) or ((local-name(..)='Viewpoint' or nodeType='Viewpoint' or EPnodeType='Viewpoint' or @nodeType='Viewpoint') and local-name()='description') or ((local-name(..)='WorldInfo' or nodeType='WorldInfo' or EPnodeType='WorldInfo' or @nodeType='WorldInfo') and local-name()='title') or (nodeType = 'String') or (EPnodeType = 'String') "> <xsl:choose> <!-- output SFString. wrap quotes (null string) if string-length 0 --> <xsl:when test="not(@value)"><xsl:text> &quot;&quot;&#10;</xsl:text></xsl:when> <!-- output SFString. no need to wrap quotes --> <xsl:when test="starts-with(normalize-space(@value),'"')"> <xsl:text>&#10;</xsl:text></xsl:when> <xsl:when test='starts-with(@value,"'")'> "<xsl:text>&quot;&#10;</xsl:text></xsl:when> <!-- output SFString with wrapped quotes since it doesn't have any--> <xsl:otherwise><xsl:text> &quot;</xsl:text><xsl:value-of select="@value" /><xsl:text>&quot;&#10;</xsl:text></xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of some special MFString types by adding enclosing &quot; &quot; marks --> <xsl:when test="((local-name(..)='FontStyle' or nodeType='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle') and (local-name()='family' or local-name()='justify')) or ((local-name(..)='NavigationInfo' or nodeType='NavigationInfo' or EPnodeType='NavigationInfo' or @nodeType='NavigationInfo') and local-name()='type')"> <xsl:choose> <!-- output MFString. wrap quotes if string-length 0 --> <xsl:when test="not(@value)"><xsl:text> [ &quot;&quot; ]&#10;</xsl:text></xsl:when> <!-- output MFString. don't modify quotes if some are there already --> <xsl:when test="contains(@value,'"')"> <xsl:text> [ </xsl:text><xsl:value-of select="@value" /><xsl:text> ]&#10;</xsl:text> </xsl:when> <!--

quotes found... -->


<!-- output MFString with wrapped quotes around token values --> <xsl:otherwise> <!-- <xsl:text>

inputString &quot;</xsl:text><xsl:value-of select="concat(normalize-space(translate(@value,'"',' ')),' ')"/><xsl:text>&quot;&#10;</xsl:text> -->


<xsl:text> [</xsl:text> <xsl:call-template name="wrap-quotes-around-tokens"> <xsl:with-param name="inputString" select="concat(normalize-space(translate(@value,'"',' ')),' ')"/> </xsl:call-template> <xsl:text> ]&#10;</xsl:text> <!--

inserted quotes around tokens... -->


</xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of MFString types by wrapping [ ] (if necessary, ensure contained SFString elements wrapped in &quot; &quot;) --> <xsl:when test="((local-name(..)='Anchor' or nodeType='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor') and (local-name()='parameter' or local-name()='url')) or ((local-name(..)='AudioClip' or nodeType='AudioClip' or EPnodeType='AudioClip' or @nodeType='AudioClip') and local-name()='url') or ((local-name(..)='Background' or nodeType='Background' or EPnodeType='Background' or @nodeType='Background') and contains(local-name(),'Url')) or ((local-name(..)='ImageTexture' or nodeType='ImageTexture' or EPnodeType='ImageTexture' or @nodeType='ImageTexture') and local-name()='url') or ((local-name(..)='Inline' or nodeType='Inline' or EPnodeType='Inline' or @nodeType='Inline') and local-name()='url') or ((local-name(..)='MovieTexture' or nodeType='MovieTexture' or EPnodeType='MovieTexture' or @nodeType='MovieTexture') and local-name()='url') or ((local-name(..)='Script' or nodeType='Script' or EPnodeType='Script' or @nodeType='Script') and local-name()='url') or ((local-name(..)='Text' or nodeType='Text' or EPnodeType='Text' or @nodeType='Text') and local-name()='string') or ((local-name(..)='WorldInfo' or nodeType='WorldInfo' or EPnodeType='WorldInfo' or @nodeType='WorldInfo') and local-name()='info') or (nodeType = 'Strings') or (EPnodeType = 'Strings')"> <xsl:choose> <!-- output MFString. wrap quotes if string-length 0 --> <xsl:when test="not(@value)"><xsl:text> [ &quot;&quot; ]&#10;</xsl:text></xsl:when> <!-- output MFString. no need to wrap quotes --> <xsl:when test="starts-with(normalize-space(@value),'"')"> [ <xsl:text> ]&#10;</xsl:text></xsl:when> <xsl:when test='starts-with(@value,"'")'> [ "<xsl:text>&quot; ]&#10;</xsl:text></xsl:when> <!-- output MFString with wrapped quotes since it doesn't have any--> <xsl:otherwise><xsl:text> [ &quot;</xsl:text><xsl:value-of select="@value" /><xsl:text>&quot; ]&#10;</xsl:text></xsl:otherwise> </xsl:choose> </xsl:when> <!-- take care of other MF field types by wrapping [ ] --> <xsl:when test="(contains(local-name(..),'Interpolator') and contains(local-name(),'key')) or ( local-name(..)='Background' or nodeType='Background' or EPnodeType='Background' or @nodeType='Background') or ((local-name(..)='ColorNode' or nodeType='ColorNode' or EPnodeType='ColorNode' or @nodeType='ColorNode' or local-name(..)='Color' or nodeType='Color' or EPnodeType='Color' or @nodeType='Color' ) and local-name()='color') or ((local-name(..)='Coordinate' or nodeType='Coordinate' or EPnodeType='Coordinate' or @nodeType='Coordinate') and local-name()='point') or ((local-name(..)='ElevationGrid' or nodeType='ElevationGrid' or EPnodeType='ElevationGrid' or @nodeType='ElevationGrid') and local-name()='height') or ((local-name(..)='Extrusion' or nodeType='Extrusion' or EPnodeType='Extrusion' or @nodeType='Extrusion') and (local-name()='crossSection' or local-name()='orientation' or local-name()='scale' or local-name()='spine')) or ((local-name(..)='IndexedFaceSet' or nodeType='IndexedFaceSet' or EPnodeType='IndexedFaceSet' or @nodeType='IndexedFaceSet') and contains(local-name(),'Index')) or ((local-name(..)='IndexedLineSet' or nodeType='IndexedLineSet' or EPnodeType='IndexedLineSet' or @nodeType='IndexedLineSet') and contains(local-name(),'Index')) or ((local-name(..)='LOD' or nodeType='LOD' or EPnodeType='LOD' or @nodeType='LOD') and local-name()='range') or ((local-name(..)='NavigationInfo' or nodeType='NavigationInfo' or EPnodeType='NavigationInfo' or @nodeType='NavigationInfo') and local-name()='avatarSize') or ((local-name(..)='Normal' or nodeType='Normal' or EPnodeType='Normal' or @nodeType='Normal') and local-name()='vector') or ((local-name(..)='Text' or nodeType='Text' or EPnodeType='Text' or @nodeType='Text') and local-name()='length') or ((local-name(..)='TextureCoordinate' or nodeType='TextureCoordinate' or EPnodeType='TextureCoordinate' or @nodeType='TextureCoordinate') and local-name()='point') or ((local-name(..)='TextureCoordinate' or nodeType='TextureCoordinate' or EPnodeType='TextureCoordinate' or @nodeType='TextureCoordinate') and local-name()='point') or MFtypes "> <!-- could put traps here to eliminate default-valued fields --> <!-- ?? is a local construct needed here to check and wrap quotes around individual string elements in MFString, if content didn't comply?? --> <xsl:text> [ </xsl:text><xsl:value-of select="@value"/><xsl:text> ]&#10;</xsl:text> </xsl:when> <!-- default field output is merely standalone value(s) --> <xsl:otherwise> <xsl:if test="."> <xsl:text>&#10;</xsl:text></xsl:if> </xsl:otherwise> </xsl:choose> </xsl:when> <!-- check if this fieldValue has an IS initialization --> <!-- ?? check: take care of IS attribute definitions for SFNode/MFNode-type field declarations inside ProtoDeclarations --> <xsl:when test="../@DEF and ancestor::*[local-name()='ProtoDeclare']/field[contains(@IS,concat(../@DEF,'.',@name))]"> <!-- pattern-match variables --> <xsl:variable name="DEFname" select="../@DEF" /> <xsl:variable name="fieldValueName" select="@name" /> <!-- <xsl:text> # DEFname </xsl:text><xsl:value-of select="DEFname"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # fieldValueName </xsl:text><xsl:value-of select="fieldValueName"/><xsl:text>&#10;</xsl:text> --> <xsl:for-each select="ancestor::*[local-name()='ProtoDeclare']/field"> <xsl:if test="starts-with(@IS,concat(DEFname, '.')) or contains(@IS,concat(' ',DEFname, '.'))"> <!-- this test seems to work when extracting appropriate substring when multiple IS references occur... --> <xsl:if test="(contains(substring-after(@IS,concat(DEFname, '.')),' ') and fieldValueName=substring-before(substring-after(@IS,concat(DEFname, '.')),' ')) or (fieldValueName=substring-after(@IS,concat(DEFname, '.')))"> <xsl:text> IS </xsl:text> <xsl:value-of select="@name"/> <!-- this is @name of ProtoDeclare/field --> <xsl:text>&#10;</xsl:text> </xsl:if> </xsl:if> </xsl:for-each> </xsl:when> <xsl:otherwise> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>improper initialization of fieldValue </xsl:text> <xsl:value-of select="@name" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- ****** field: used inside Script, ProtoDeclare, ExternProtoDeclare. ****** --> <xsl:template match="field"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:call-template name="print-indent"></xsl:call-template> <!-- first, field type --> <xsl:choose> <xsl:when test="@accessType='eventIn' "><xsl:text>eventIn </xsl:text></xsl:when> <xsl:when test="@accessType='eventOut' "><xsl:text>eventOut </xsl:text></xsl:when> <xsl:when test="@accessType='field' "><xsl:text>field </xsl:text></xsl:when> <xsl:when test="not(local-name(..)='Script') and @accessType='exposedField' "><xsl:text>exposedField </xsl:text></xsl:when> <xsl:when test="local-name(..)='Script' and @accessType='exposedField' "> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:value-of select="@name" /> <xsl:text> access type &apos;exposedField&apos; not allowed in VRML 97 Script, using &apos;field&apos; instead</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>parent </xsl:text> <xsl:value-of select="local-name(..)" /> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> <xsl:text>field </xsl:text> </xsl:when> <!-- unspecified or unknown accessType (eventIn|eventOut|field|exposedField) --> <!-- Scripts cannot contain exposedField so default becomes VRML 97 'field' --> <xsl:when test="not(@accessType)"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>accessType value not set for field '</xsl:text> <xsl:value-of select="@name" /> <xsl:text>', setting accessType=&apos;field&apos;</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:text> "</xsl:text> <xsl:value-of select="../@name" /> <xsl:text>"</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> <xsl:text>field </xsl:text> </xsl:when> </xsl:choose> <!-- next, base type --> <xsl:choose> <xsl:when test="@type='Boolean' "><xsl:text>SFBool </xsl:text></xsl:when> <xsl:when test="@type='Booleans' "><xsl:text>SFString </xsl:text></xsl:when> <!-- someday: MFBool --> <xsl:when test="@type='Color' "><xsl:text>SFColor </xsl:text></xsl:when> <xsl:when test="@type='Colors' "><xsl:text>MFColor </xsl:text></xsl:when> <xsl:when test="@type='Float' "><xsl:text>SFFloat </xsl:text></xsl:when> <xsl:when test="@type='Floats' "><xsl:text>MFFloat </xsl:text></xsl:when> <xsl:when test="@type='Image' "><xsl:text>SFImage </xsl:text></xsl:when> <xsl:when test="@type='Integer' "><xsl:text>SFInt32 </xsl:text></xsl:when> <xsl:when test="@type='Integers' "><xsl:text>MFInt32 </xsl:text></xsl:when> <xsl:when test="@type='Node' "><xsl:text>SFNode </xsl:text></xsl:when> <xsl:when test="@type='Nodes' "><xsl:text>MFNode </xsl:text></xsl:when> <xsl:when test="@type='Rotation' "><xsl:text>SFRotation </xsl:text></xsl:when> <xsl:when test="@type='Rotations' "><xsl:text>MFRotation </xsl:text></xsl:when> <xsl:when test="@type='String' "><xsl:text>SFString </xsl:text></xsl:when> <xsl:when test="@type='Strings' "><xsl:text>MFString </xsl:text></xsl:when> <xsl:when test="@type='Time' "><xsl:text>SFTime </xsl:text></xsl:when> <xsl:when test="@type='Times' "><xsl:text>MFTime </xsl:text></xsl:when> <xsl:when test="@type='Vector2Float' "><xsl:text>SFVec2f </xsl:text></xsl:when> <xsl:when test="@type='Vector2FloatArray' "><xsl:text>MFVec2f </xsl:text></xsl:when> <xsl:when test="@type='Vector3Float' "><xsl:text>SFVec3f </xsl:text></xsl:when> <xsl:when test="@type='Vector3FloatArray' "><xsl:text>MFVec3f </xsl:text></xsl:when> <!-- unknown or previously unspecified type --> <xsl:when test="not(@type) "> <xsl:text>__absentTypeError__</xsl:text> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>type is required for field variables</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:otherwise><xsl:value-of select="@type"/><xsl:text> </xsl:text></xsl:otherwise> </xsl:choose> <!-- next, field name --> <xsl:value-of select="@name"/> <!-- next, IS name --> <!-- pattern-match variables --> <xsl:variable name="DEFname" select="../@DEF" /> <xsl:variable name="fieldName" select="@name" /> <xsl:variable name="parentNodeName" select="local-name(..)" /> <xsl:variable name="parentName" select="../@name" /> <xsl:variable name="matchName" select="concat(' ', DEFname, '.', fieldName, ' ')" /> <!-- <xsl:text> # DEFname </xsl:text><xsl:value-of select="DEFname"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # fieldName </xsl:text><xsl:value-of select="fieldName"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:message><xsl:text> # matchName </xsl:text><xsl:value-of select="matchName"/><xsl:text>&#10;</xsl:text></xsl:message> --> <xsl:if test="local-name(..)='Script' and ../@DEF"> <!-- <xsl:text> # ancestor PROTO field </xsl:text><xsl:value-of select="local-name(ancestor::*[local-name()='ProtoDeclare'])"/><xsl:text>&#10;</xsl:text> --> <xsl:for-each select="ancestor::*[local-name()='ProtoDeclare']/field[contains(concat(' ',normalize-space(@IS),' '),matchName)]"> <!-- <xsl:text> # node rule: @IS </xsl:text><xsl:value-of select="@IS"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # (starts-with(@IS,concat(DEFname, '.')) </xsl:text><xsl:value-of select="starts-with(@IS,concat(DEFname, '.'))"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # concat(DEFname, '.') </xsl:text><xsl:value-of select="concat(DEFname, '.')"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # @type </xsl:text><xsl:value-of select="@type"/><xsl:text>&#10;</xsl:text> --> <!-- <xsl:text> # substring-after(@IS,'.') </xsl:text><xsl:value-of select="substring-after(@IS,'.')"/><xsl:text>&#10;</xsl:text> --> <xsl:if test="position()=1"> <xsl:text> IS</xsl:text> </xsl:if> <xsl:text> </xsl:text> <xsl:value-of select="@name"/> </xsl:for-each> </xsl:if> <!-- <xsl:message><xsl:text>... past for-each</xsl:text></xsl:message> --> <!-- check that IS nodes match corresponding children inside ProtoDeclare--> <xsl:if test="@IS and (local-name(..)='ProtoDeclare')"> <xsl:call-template name="check-IS-nodes"> <xsl:with-param name="list" select="@IS"/> </xsl:call-template> </xsl:if> <!-- check that @value is not provided as initializing value for fields of type Node/Nodes--> <xsl:if test="(@type='Node' or @type='Nodes') and @value and (@value!='NULL')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>cannot initialize field of type </xsl:text> <xsl:value-of select="@type" /> <xsl:text> with @value="</xsl:text> <xsl:value-of select="@value" /> <xsl:text>"; initialize with no entry, value="NULL", contained node(s) or @USE instead.</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- check that @USE only appears as initializing value for fields of type Node/Nodes--> <xsl:if test="@USE and not(@type='Node' or @type='Nodes')"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>ignoring USE="</xsl:text> <xsl:value-of select="@USE" /> <xsl:text>" since USE is only allowed to initialize fields of type Node/Nodes</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- check that both @USE and contained content not provided simultaneously as initializing value for fields of type Node/Nodes--> <xsl:if test="@USE and (@type='Node' or @type='Nodes') and *"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>ignoring USE="</xsl:text> <xsl:value-of select="@USE" /> <xsl:text>" since initializing with contained content nodes</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- last, provide initializing value (if appropriate) --> <xsl:choose> <!-- no initial value allowed for IS fields --> <xsl:when test="(local-name(..)='Script' or local-name(..)='ExternProtoDeclare') and @IS"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>IS declarations not allowed for Script or ExternProtoDeclare fields, ignoring IS="</xsl:text> <xsl:value-of select="@IS" /> <xsl:text>"</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="@value and local-name(..)='Script' and ../@DEF and ancestor::*[local-name()='ProtoDeclare']/field[@name=fieldName and contains(@IS,concat(DEFname, '.', fieldName))]"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Script field initialization value not allowed in addition to ProtoDeclare interface IS declarations, ignoring initial value="</xsl:text> <xsl:value-of select="@value" /> <xsl:text>"</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- properly declared Script field with corresponding IS in prototype declaration - no action required --> <xsl:when test="local-name(..)='Script' and ../@DEF and ancestor::*[local-name()='ProtoDeclare']/field[contains(concat(' ',@IS,' '),matchName)]"> <!-- <xsl:message><xsl:text>... matching IS found</xsl:text></xsl:message> --> <!-- matching IS found --> <xsl:if test="@value"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>initialization value not allowed in addition to IS declarations, ignoring initial value='</xsl:text> <xsl:value-of select="@value" /> <xsl:text>'</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- <xsl:message><xsl:text>... check for-each</xsl:text></xsl:message> --> <xsl:variable name="accessType" select="@accessType"/> <xsl:for-each select="ancestor::*[local-name()='ProtoDeclare']/field[contains(concat(' ',@IS,' '),matchName)]"> <!-- context is now within field located by for-each --> <xsl:if test="accessType!=@accessType"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:value-of select="parentNodeName" /> <xsl:text> field </xsl:text> <xsl:value-of select="fieldName" /> <xsl:text> accessType='</xsl:text> <xsl:value-of select="@accessType" /> <xsl:text>' does not match IS accessType='</xsl:text> <xsl:value-of select="@accessType" /> <xsl:text>' of ProtoDeclare field '</xsl:text> <xsl:value-of select="@name" /> <xsl:text>'</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="fieldName" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="parentNodeName" /> <xsl:text> </xsl:text> <xsl:value-of select="parentName" /> </xsl:with-param> <xsl:with-param name="DEF" select="DEFname"/> </xsl:call-template> </xsl:if> </xsl:for-each> </xsl:when> <!-- no initial value for ExternProtoDeclare fields --> <xsl:when test="@value and local-name(..)='ExternProtoDeclare'"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>initialization value not allowed inside EXTERNPROTO field declarations, ignoring initial value="</xsl:text> <xsl:value-of select="@value" /> <xsl:text>"</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="local-name(..)='ExternProtoDeclare'"><!-- ignore, no value is the correct case for ExternProtoDeclare --></xsl:when> <!-- eventIn, eventOut --> <xsl:when test="((@accessType='eventIn') or (@accessType='eventOut')) and @value"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>ignoring initial value="</xsl:text> <xsl:value-of select="@value" /> <xsl:text>" for </xsl:text> <xsl:value-of select="@accessType" /> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="((@accessType='eventIn') or (@accessType='eventOut'))"><!-- no value required --></xsl:when> <!-- wrap SFStrings in quotes --> <xsl:when test="@type='String' and @value"> "<xsl:text>&quot;</xsl:text></xsl:when> <!-- output MFString. wrap quotes if string-length 0 or 1 --> <xsl:when test="(@type='Strings' and (string-length(@value)=0 or string-length(@value)=1))"> [ "<xsl:text>&quot;&#10;]</xsl:text></xsl:when> <xsl:when test="(@type='Strings' and starts-with(@value,'"'))"> [ <xsl:text>&#10;]</xsl:text></xsl:when> <xsl:when test='(@type="Strings" and starts-with(@value,"'"))'> [ "<xsl:text>&quot;&#10;]</xsl:text></xsl:when> <!-- output MFString with wrapped quotes when it doesn't have any--> <xsl:when test="(@type='Strings')"> <xsl:text> [ &quot;</xsl:text><xsl:value-of select="@value" /><xsl:text>&quot; ]</xsl:text></xsl:when> <!-- output SFNode if initializing child present --> <xsl:when test="@type='Node' and *"> <xsl:text> </xsl:text> <xsl:apply-templates select="*"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <!-- output MFNode if initializing children present --> <xsl:when test="@type='Nodes' and *"> <xsl:text> [&#10;</xsl:text> <xsl:apply-templates select="*"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:text>]</xsl:text> </xsl:when> <!-- straightforward output cases follow, check whether SF (single field) or MF (multiple field) values --> <!-- error: embedded SFNode/MFNode when USE present --> <xsl:when test="@USE and *"> <xsl:text> USE </xsl:text> <xsl:value-of select="@USE"/> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>no embedded node content allowed together with USE="</xsl:text> <xsl:value-of select="@USE" /> <xsl:text>"</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> <xsl:apply-templates select="comment()"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <!-- error: incorrect field type when USE present --> <xsl:when test="@USE and not(@type='Node' or @type='Nodes')"> <xsl:text> USE </xsl:text><xsl:value-of select="@USE"/> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>mismatched type="</xsl:text> <xsl:value-of select="@type" /> <xsl:text>", should be type Node or Nodes for USE="</xsl:text> <xsl:value-of select="@USE" /> <xsl:text>"</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> <xsl:apply-templates select="comment()"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <!-- output SFNode/MFNode name if USE present --> <xsl:when test="@USE and (@type='Node' or @type='Nodes')"> <xsl:text> USE </xsl:text> <xsl:value-of select="@USE"/> <xsl:apply-templates select="comment()"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:when> <xsl:when test="@value"> <!-- <xsl:text> # @value found &#10;</xsl:text> --> <xsl:choose> <!-- output Boolean values --> <xsl:when test="@type='Boolean' and @value='true'"><xsl:text> TRUE</xsl:text></xsl:when> <xsl:when test="@type='Boolean' and @value='false'"><xsl:text> FALSE</xsl:text></xsl:when> <xsl:when test="@type='Boolean'"> <xsl:text>

invalid Boolean value! </xsl:text></xsl:when>


<xsl:when test="@type='Booleans'"> "<xsl:value-of select="@value" />" # type Booleans </xsl:when> <!-- <xsl:when test="@type='Booleans'"> [ <xsl:text> ]</xsl:text></xsl:when> --> <!-- output other SF values (Node is possible, might contain NULL) --> <xsl:when test="(@type='Color' or @type='Float' or @type='Image' or @type='Integer' or @type='Node' or @type='Rotation' or @type='String' or @type='Time' or @type='Vector2Float' or @type='Vector3Float' )"> </xsl:when> <!-- output other MF values (Nodes is possible, might contain NULL) --> <xsl:when test="(@type='Colors' or @type='Floats' or @type='Integers' or @type='Nodes' or @type='Rotations' or @type='Strings' or @type='Times' or @type='Vector2FloatArray' or @type='Vector3FloatArray' )"> [ <xsl:text> ]</xsl:text></xsl:when> <xsl:otherwise><xsl:text> </xsl:text><xsl:value-of select="@value" /><xsl:text> # unknown type!</xsl:text></xsl:otherwise> </xsl:choose> <!-- validate attribute values --> <xsl:call-template name="attribute-value-validation"> <xsl:with-param name="name"></xsl:with-param> <xsl:with-param name="type"></xsl:with-param> <xsl:with-param name="value"></xsl:with-param> </xsl:call-template> </xsl:when> <!-- no value provided for field or exposedField, or no Node/Nodes children, or no hint provided, must determine default value --> <xsl:otherwise> <!-- otherwise show default value, except when IS provides the value --> <xsl:choose> <xsl:when test="@type='Node' "><xsl:text> NULL</xsl:text></xsl:when> <xsl:when test="@type='Nodes' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Boolean' "><xsl:text> FALSE</xsl:text></xsl:when> <xsl:when test="@type='Booleans' "> ""</xsl:when> <!-- <xsl:when test="@type='Booleans' "><xsl:text> [ ]</xsl:text></xsl:when> --> <xsl:when test="@type='Color' "><xsl:text> 0 0 0</xsl:text></xsl:when> <xsl:when test="@type='Colors' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Float' "><xsl:text> 0.0</xsl:text></xsl:when> <xsl:when test="@type='Floats' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Image' "><xsl:text> 0 0 0</xsl:text></xsl:when> <xsl:when test="@type='Integer' "><xsl:text> 0</xsl:text></xsl:when> <xsl:when test="@type='Integers' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Rotation' "><xsl:text> 0 0 1 0</xsl:text></xsl:when> <xsl:when test="@type='Rotations' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='String' "> ""</xsl:when> <xsl:when test="@type='Strings' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Time' "><xsl:text> -1</xsl:text></xsl:when> <xsl:when test="@type='Times' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Vector2Float' "><xsl:text> 0 0</xsl:text></xsl:when> <xsl:when test="@type='Vector2FloatArray' "><xsl:text> [ ]</xsl:text></xsl:when> <xsl:when test="@type='Vector3Float' "><xsl:text> 0 0 0</xsl:text></xsl:when> <xsl:when test="@type='Vector3FloatArray' "><xsl:text> [ ]</xsl:text></xsl:when> <!-- unknown or previously unspecified type --> <xsl:when test="not(@type) "><!-- ignore, no further action required --></xsl:when> <xsl:otherwise><xsl:value-of select="@type"/><!-- ignore, no further action required --></xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> <xsl:if test="@IS"> <xsl:choose> <xsl:when test="local-name(..)='ExternProtoDeclare' "> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>IS="</xsl:text> <xsl:value-of select="@IS" /> <xsl:text>" references not allowed inside ExternProto field declarations</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="local-name(..)='ProtoDeclare'"> <xsl:text> # IS </xsl:text><xsl:value-of select="@IS" /> </xsl:when> <xsl:when test="local-name(..)='Script'"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>IS definitions usually belong in ProtoDeclare field definitions, pointing to contained Script node fields.</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>why an IS="</xsl:text> <xsl:value-of select="@IS" /> <xsl:text>" reference here?</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:if> <xsl:if test="@type='Booleans'"><xsl:text> # type Booleans </xsl:text></xsl:if> <xsl:apply-templates select="@appInfo|@documentation"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:if test="comment()"> <xsl:text>&#10;</xsl:text> <xsl:apply-templates select="comment()"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> </xsl:if> <!-- finished with this field --> <xsl:text>&#10;</xsl:text> </xsl:template> <!-- ****** ExternProtoDeclare ****** --> <xsl:template match="ExternProtoDeclare"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>EXTERNPROTO </xsl:text> <xsl:value-of select="@name" /> <xsl:text> [&#10;</xsl:text> <xsl:choose> <xsl:when test="@nodeType"> <xsl:text> # nodeType </xsl:text><xsl:value-of select="@nodeType" /><xsl:text>&#10;</xsl:text> </xsl:when> <xsl:otherwise> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>nodeType not found, assuming ChildNodeType.</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>ExternProtoDeclare </xsl:text> <xsl:value-of select="@name" /> </xsl:with-param> </xsl:call-template> </xsl:otherwise> </xsl:choose> <xsl:apply-templates select="@appInfo|@documentation"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:if test="@appInfo|@documentation|@nodeType"><xsl:text>&#10;</xsl:text></xsl:if> <!-- ExternProtoDeclare is only allowed to contain X3D field tags, no initializations or IS statements, check each --> <xsl:apply-templates select="field | comment()"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <!-- finish with URLs --> <xsl:text>][&#10;</xsl:text> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:choose> <!-- output url MFString. wrap quotes if necessary --> <xsl:when test="not(@url)"><xsl:text>&quot;&quot; # error, no URL(s) provided for EXTERNPROTO&#10;</xsl:text></xsl:when> <xsl:when test="string-length(@url)=1"> "<xsl:text>&quot;</xsl:text></xsl:when> <xsl:when test="starts-with(@url,'"')"> </xsl:when> <xsl:when test='starts-with(@url,"'")'> </xsl:when> <!-- output MFString with wrapped quotes since it doesn't have any (but could still be multiple URLs, which is bad!) --> <xsl:otherwise><xsl:text> &quot;</xsl:text><xsl:value-of select="@url" /><xsl:text>&quot;</xsl:text></xsl:otherwise> </xsl:choose> <xsl:text>&#10;</xsl:text> <xsl:call-template name="print-indent"></xsl:call-template> <xsl:text> ]&#10;</xsl:text> </xsl:template> <!-- ****** ProtoDeclare ****** --> <xsl:template match="ProtoDeclare"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:call-template name="print-indent"></xsl:call-template> <xsl:text>PROTO </xsl:text><xsl:value-of select="@name" /><xsl:text> [&#10;</xsl:text> <xsl:apply-templates select="@appInfo|@documentation"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:if test="@appInfo|@documentation"><xsl:text>&#10;</xsl:text></xsl:if> <!-- ProtoDeclare is allowed to contain X3D field tags and content, check each field tag first --> <xsl:apply-templates select="field | comment()[following-sibling::field]"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <!-- now handle embedded content --> <xsl:text>] {&#10;</xsl:text> <!-- recurse on non-field-tag children --> <xsl:apply-templates select="*[local-name()!='field'] | comment()[not(following-sibling::field)]"> <xsl:with-param name="indent" select="indent + 2"/> </xsl:apply-templates> <xsl:text>}&#10;</xsl:text> </xsl:template> <!-- ****** children elements: ignore wrapper tags (since redundant with VRML definitions) ****** --> <xsl:template match="appearance[local-name(..)='Shape'] | children[local-name(..)='Anchor' or local-name(..)='Billboard' or local-name(..)='Collision' or local-name(..)='Group' or local-name(..)='Transform' or local-name(..)='GeoInline' or local-name(..)='GeoLocation' or local-name(..)='GeoLOD' or local-name(..)='Joint' or local-name(..)='Segment' or local-name(..)='Site' or local-name(..)='EspduTransform' or local-name(..)='ProtoInstance' or local-name(..)] | choice[local-name(..)='Switch'] | color[local-name(..)='ElevationGrid' or local-name(..)='GeoElevationGrid' or local-name(..)='IndexedFaceSet' or local-name(..)='IndexedLineSet' or local-name(..)='PointSet'] | coord[local-name(..)='IndexedFaceSet' or local-name(..)='IndexedLineSet' or local-name(..)='PointSet'] | fontStyle[local-name(..)='Text'] | geometry[local-name(..)='Shape'] | level[local-name(..)='LOD'] | material[local-name(..)='Appearance'] | normal[local-name(..)='ElevationGrid' or local-name(..)='GeoElevationGrid' or local-name(..)='IndexedFaceSet'] | source[local-name(..)='Sound'] | texCoord[local-name(..)='ElevationGrid' or local-name(..)='GeoElevationGrid' or local-name(..)='IndexedFaceSet'] | texture[local-name(..)='Appearance'] | textureTransform[local-name(..)='Appearance'] | sites[local-name(..)='Humanoid' and not(*)]"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <!-- <xsl:text># indent=</xsl:text><xsl:value-of select="indent"/><xsl:text>

&#10;</xsl:text> -->


<xsl:text>

wrapper tag: </xsl:text>


<xsl:value-of select="local-name()"/> <xsl:text>&#10;</xsl:text> <xsl:apply-templates> <xsl:with-param name="indent" select="indent"/> </xsl:apply-templates> </xsl:template> <xsl:template name="tokenCount"> <xsl:param name="parameter"/> <!-- thanks to Marc Jablonski for this great technique --> <xsl:variable name="tokens" select="string-length( normalize-space(parameter)) - string-length(translate(normalize-space(parameter),' ','')) + 1"/> <xsl:value-of select="tokens"/> <!-- debug <xsl:message> <xsl:text>tokenCount ('</xsl:text> <xsl:value-of select="parameter"/> <xsl:text>')=</xsl:text> <xsl:value-of select="tokens"/> </xsl:message> --> </xsl:template> <!-- attribute-value-validation can be invoked by @*, field and fieldValue rules --> <xsl:template name="attribute-value-validation"> <xsl:param name="name"><xsl:text></xsl:text></xsl:param> <xsl:param name="value"><xsl:text></xsl:text></xsl:param> <xsl:param name="type"><xsl:text></xsl:text></xsl:param> <!-- compute tuple count: first convert commas to spaces, then normalize, then despace, then compare --> <xsl:variable name="normalizeSpaceValue"> <xsl:choose> <!-- GeoSpatial profile coordinates are encoded as String/Strings, need to become Doubles in future version --> <xsl:when test="starts-with(name,'geo') or starts-with(local-name(..),'Geo')"> <xsl:value-of select="normalize-space(translate(value,',"',' '))"/> </xsl:when> <!-- remove commas, which are treated as whitespace in VRML attributes --> <xsl:otherwise> <xsl:value-of select="normalize-space(translate(value,',',' '))"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="blankedValue" select="concat(' ',normalizeSpaceValue,' ')"/> <xsl:variable name="nonSpaceValue" select="translate(normalizeSpaceValue,' ','')"/> <xsl:variable name="tupleCount" select="(string-length(normalizeSpaceValue) - string-length(nonSpaceValue)) + 1"/> <!-- debug <xsl:message> <xsl:text>attribute-value-validation </xsl:text> <xsl:text>name=</xsl:text><xsl:value-of select="name"/><xsl:text>, </xsl:text> <xsl:text>value=</xsl:text><xsl:value-of select="value"/><xsl:text>, </xsl:text> <xsl:text>type=</xsl:text><xsl:value-of select="type"/><xsl:text>, </xsl:text> <xsl:text>tupleCount=</xsl:text><xsl:value-of select="tupleCount"/> </xsl:message> --> <xsl:variable name="errorNodeName"> <xsl:value-of select="local-name(..)"/> <xsl:choose> <xsl:when test="local-name(..)='Script' or local-name(..)='ProtoDeclare' or local-name(..)='ProtoInstance' or local-name(..)='ExternProtoDeclare'"> <xsl:text> '</xsl:text> <xsl:value-of select="../@name"/> <xsl:text>'</xsl:text> </xsl:when> <xsl:when test="local-name(..)='field' or local-name(..)='fieldValue'"> <xsl:text> '</xsl:text> <xsl:value-of select="../@name"/> <xsl:text>'</xsl:text> <xsl:text> parent </xsl:text> <xsl:value-of select="local-name(../..)"/> <xsl:text> '</xsl:text> <xsl:value-of select="../../@name"/> <xsl:text>'</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> node</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- square brackets not allowed in any type except String(s), check for them in case someone confuses X3D with VRML array encoding --> <!-- ... also need to check reenumeration values --> <xsl:if test="not(type='String' or type='Strings') and contains(.,'[') or contains(.,']')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> cannot include [square brackets] in attribute value</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- start checking typed values, first non-numerics then numerics --> <xsl:choose> <xsl:when test="type='Boolean'"> <xsl:if test="normalize-space(value) and (value!='' and value!='true' and value!='false')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> not a valid Boolean value (true|false)</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="type='Booleans'"> <xsl:variable name="BooleansResidue" select="normalize-space(translate(value,'truefalse',' '))"/> <!-- not a perfect test, but it catches everything except letter scrambles --> <xsl:if test="(BooleansResidue!=' ' and BooleansResidue!='')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:text>Attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> includes character</xsl:text> <xsl:if test="string-length(BooleansResidue)!=1"> <xsl:text>s</xsl:text> </xsl:if> <xsl:text> '</xsl:text> <xsl:value-of select="BooleansResidue"/> <xsl:text>' other than a valid Boolean value (true|false)</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="type='String' or type='Strings'"> <!-- no checks. Enumeration-value tests are only performed for native VRML attributes since prototypes may override them. --> </xsl:when> <xsl:when test="normalize-space(value)=''"> <!-- no value, ignore. --> </xsl:when> <!-- test numeric attribute contents --> <xsl:otherwise> <!-- clear out nonNumericValue digits --> <xsl:variable name="nonFloatResidue" select="normalize-space(translate(normalizeSpaceValue,'eE0123456789+-.,',' '))"/> <xsl:variable name="nonIntegerResidue" select="normalize-space(translate(normalizeSpaceValue,'0123456789+-,', ' ' ))"/> <xsl:variable name="capitalEValue" select="concat(normalize-space(translate(normalizeSpaceValue,'e','E')),' ')"/> <xsl:choose> <!-- ensure numeric, include special checks for some forms of erroneous exponential notation --> <!-- floating-point types --> <xsl:when test="type='Color' or type='Colors' or type='Float' or type='Floats' or type='Rotation' or type='Rotation' or type='Time' or type='Times' or type='Vector2Float' or type='Vector2FloatArray' or type='Vector3Float' or type='Vector3FloatArray' or type='Vector3Double' or type='Vector3DoubleArray'"> <xsl:choose> <xsl:when test="(nonFloatResidue!='' and nonFloatResidue!=' ')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains illegal non-numeric character</xsl:text> <xsl:if test="string-length(nonFloatResidue)!=1"> <xsl:text>s</xsl:text> </xsl:if> <xsl:text> '</xsl:text> <xsl:value-of select="nonFloatResidue"/> <xsl:text>'</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="contains(capitalEValue,' E') or contains(capitalEValue,'E ') or contains(capitalEValue,'.E') or contains(capitalEValue,'E.') or contains(capitalEValue,',E') or contains(capitalEValue,'E,') or contains(capitalEValue,'+E') or contains(capitalEValue,'-E')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains malformed exponential notation</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="contains(concat(value,' '),'+ ') or contains(concat(value,' '),'- ')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains isolated sign operator ( + , - )</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:when> <!-- integer types --> <xsl:when test="type='Integer' or type='Integers'"> <xsl:choose> <xsl:when test="(nonIntegerResidue!='' and nonIntegerResidue!=' ')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains illegal non-numeric character</xsl:text> <xsl:if test="string-length(nonIntegerResidue)!=1"> <xsl:text>s</xsl:text> </xsl:if> <xsl:text> '</xsl:text> <xsl:value-of select="nonIntegerResidue"/> <xsl:text>'</xsl:text> <xsl:if test="contains(nonIntegerResidue,'.')"> <xsl:text> and must be integral, not floating point</xsl:text> </xsl:if> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <xsl:when test="contains(concat(value,' '),'+ ') or contains(concat(value,' '),'- ')"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="name"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains isolated sign operator ( + , - )</xsl:text> </xsl:with-param> <xsl:with-param name="node" select="errorNodeName"/> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> <!-- type-by-type tuple checks for correct number of attribute values, enumerations handled separately/individually --> <xsl:choose> <!-- 1-tuple --> <xsl:when test="(type='Boolean') or (type='Integer') or (type='Float') or (type='Double')"> <xsl:if test="tupleCount!=1"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain only 1 value</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- 2-tuple --> <xsl:when test="(type='Vector2Float') or (type='Vector2Double')"> <xsl:if test="tupleCount!=2"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain 2 values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- 3-tuple --> <xsl:when test="(type='Color') or (type='Vector3Float') or (type='Vector3Double')"> <xsl:if test="tupleCount!=3"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain 3 values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- 4-tuple --> <xsl:when test="(type='Rotation')"> <xsl:choose> <xsl:when test="tupleCount!=4"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain 4 values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> <!-- range check [-1..1] for first three values (need some way to discriminate fourth..., watch out for exponent negations too... ) <xsl:variable name="negativeBlankedValue" select="translate(blankedValue,'-',' ')"/> <xsl:when test="( contains(negativeBlankedValue,' 2') or contains(negativeBlankedValue,' 3') or contains(negativeBlankedValue,' 4') or contains(negativeBlankedValue,' 5') or contains(negativeBlankedValue,' 6') or contains(negativeBlankedValue,' 7') or contains(negativeBlankedValue,' 8') or contains(negativeBlankedValue,' 9'))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> first three values must be in range [-1..1]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:when> --> </xsl:choose> </xsl:when> <!-- 2-tuple array --> <xsl:when test="(type='Vector2FloatArray') or (type='Vector2DoubleArray')"> <xsl:if test="(tupleCount mod 2) != 0"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain an even multiple of paired values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- 3-tuple array --> <xsl:when test="(type='Colors') or (type='Vector3FloatArray') or (type='Vector3DoubleArray')"> <xsl:if test="(tupleCount mod 3) != 0"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain an even multiple of triplet values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> <!-- 4-tuple array --> <xsl:when test="(type='Rotations')"> <xsl:if test="(tupleCount mod 4) != 0"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> must contain an integer multiple of 4-tuple values</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:when> </xsl:choose> <!-- Color values in range [0..1] --> <xsl:if test="((type='Color') or (type='Colors')) and (contains(blankedValue,' -') or contains(blankedValue,' 2') or contains(blankedValue,' 3') or contains(blankedValue,' 4') or contains(blankedValue,' 5') or contains(blankedValue,' 6') or contains(blankedValue,' 7') or contains(blankedValue,' 8') or contains(blankedValue,' 9'))"> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> <xsl:value-of select="type"/> <xsl:text> attribute </xsl:text> <xsl:value-of select="local-name()"/> <xsl:text>='</xsl:text><xsl:value-of select="substring(normalize-space(value),1,100)"/><xsl:text>'</xsl:text> <xsl:text> contains RGB value(s) outside allowed range [0..1]</xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:value-of select="local-name(..)"/> <xsl:text> node</xsl:text> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="print-indent"> <xsl:param name="indent"><xsl:text>0</xsl:text></xsl:param> <xsl:if test="indent > 0"> <xsl:text> </xsl:text> <xsl:call-template name="print-indent"> <xsl:with-param name="indent" select="indent - 1"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="wrap-quotes-around-tokens"> <xsl:param name="inputString"><xsl:text></xsl:text></xsl:param> <!-- <xsl:text>

inputString received: </xsl:text><xsl:value-of select="inputString"/><xsl:text>&#10;</xsl:text> -->


<xsl:choose> <xsl:when test="contains(inputString,' ')"> <xsl:text> &quot;</xsl:text> <xsl:value-of select="substring-before(inputString,' ')"/> <xsl:text>&quot;</xsl:text> <xsl:if test="substring-after(inputString,' ')"> <xsl:call-template name="wrap-quotes-around-tokens"> <xsl:with-param name="inputString" select="substring-after(inputString,' ')"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:value-of select="inputString"/> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- ****** check-IS-nodes: callable template (recursive function) ****** --> <!-- follows examples in Michael Kay's _XSLT_, pp. 551-554 --> <xsl:template name="check-IS-nodes"> <xsl:param name="list"/> <xsl:variable name="wlist" select="concat(normalize-space(list),' ')"/> <!-- <xsl:text>&#10;wlist=[</xsl:text><xsl:value-of select="wlist" disable-output-escaping="yes"/><xsl:text>]&#10;</xsl:text> --> <xsl:choose> <xsl:when test="wlist!=' '"> <xsl:variable name="nextPair" select="translate(substring-before(wlist,' '),'"','')"/> <xsl:variable name="restPairs" select="substring-after(wlist,' ')"/> <!-- <xsl:text>&#10;restPairs=[</xsl:text><xsl:value-of select="restPairs" disable-output-escaping="yes"/><xsl:text>]&#10;</xsl:text> --> <xsl:variable name="nextDEF" select="substring-before(nextPair,'.')"/> <xsl:if test="not(contains(nextPair,'.'))"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Node DEF.field pair "</xsl:text> <xsl:value-of select="nextPair" /> <xsl:text>" missing "." delimiter between DEF name and field name. </xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <xsl:if test="contains(nextPair,'.') and not(..//*[@DEF=nextDEF])"> <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> <xsl:text>Node "</xsl:text> <xsl:value-of select="nextDEF" /> <xsl:text>" specified by IS attribute (for field "</xsl:text> <xsl:value-of select="@name" /> <xsl:text>") not found inside ProtoDeclare "</xsl:text> <xsl:value-of select="../@name" /> <xsl:text>" </xsl:text> </xsl:with-param> <xsl:with-param name="node"> <xsl:text>field </xsl:text> <xsl:value-of select="@name" /> <xsl:text>, parent </xsl:text> <xsl:value-of select="local-name(..)" /> <xsl:if test="../@name"> <xsl:text> </xsl:text> <xsl:value-of select="../@name" /> </xsl:if> </xsl:with-param> <xsl:with-param name="DEF" select="../@DEF"/> </xsl:call-template> </xsl:if> <!-- recurse on remainder of list of URLs --> <xsl:if test="restPairs!=''"> <xsl:call-template name="check-IS-nodes"> <xsl:with-param name="list" select="restPairs"/> </xsl:call-template> </xsl:if> </xsl:when> </xsl:choose> </xsl:template> <!-- <xsl:call-template name="output-warning"> <xsl:with-param name="warningString"> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> <xsl:call-template name="output-error"> <xsl:with-param name="errorString"> </xsl:with-param> <xsl:with-param name="node" select="local-name()"/> <xsl:with-param name="DEF" select="@DEF"/> </xsl:call-template> --> <xsl:template name="output-warning"> <xsl:param name="warningString"/> <xsl:param name="node"> <xsl:text>node</xsl:text> </xsl:param> <xsl:param name="DEF"/> <!-- <xsl:text>

warningString received: </xsl:text><xsl:value-of select="normalize-space(warningString)"/><xsl:text>&#10;</xsl:text> -->


<xsl:text>

</xsl:text>


<xsl:text>warning: </xsl:text> <xsl:value-of select="warningString"/> <xsl:text>&#10;</xsl:text> <xsl:message> <xsl:text>[Warning] </xsl:text> <xsl:value-of select="warningString"/> <xsl:text> [</xsl:text> <xsl:choose> <xsl:when test="DEF"> <xsl:value-of select="node"/> <xsl:text> DEF='</xsl:text> <xsl:value-of select="DEF"/> <xsl:text>'</xsl:text> </xsl:when> <xsl:when test="local-name(..)='fieldValue' or local-name(..)='field'"> <xsl:text> </xsl:text> <xsl:value-of select="local-name(..)"/> <xsl:text> name='</xsl:text> <xsl:value-of select="../@name"/> <xsl:text>'</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>check X3D source or VRML output to find questionable </xsl:text> <xsl:value-of select="node"/> </xsl:otherwise> </xsl:choose> <xsl:text>]</xsl:text> </xsl:message> </xsl:template> <xsl:template name="output-error"> <xsl:param name="errorString"/> <xsl:param name="node"> <xsl:text>node</xsl:text> </xsl:param> <xsl:param name="DEF"/> <!-- <xsl:text>

errorString received: </xsl:text><xsl:value-of select="normalize-space(errorString)"/><xsl:text>&#10;</xsl:text> -->


<xsl:text>

</xsl:text>


<xsl:text>error: </xsl:text> <xsl:value-of select="errorString"/> <xsl:text>&#10;</xsl:text> <xsl:message> <xsl:text>[Error] </xsl:text> <xsl:value-of select="errorString"/> <xsl:text> [</xsl:text> <xsl:choose> <xsl:when test="DEF"> <xsl:value-of select="node"/> <xsl:text> DEF='</xsl:text> <xsl:value-of select="DEF"/> <xsl:text>'</xsl:text> </xsl:when> <xsl:when test="local-name(..)='fieldValue' or local-name(..)='field'"> <xsl:text> </xsl:text> <xsl:value-of select="local-name(..)"/> <xsl:text> name='</xsl:text> <xsl:value-of select="../@name"/> <xsl:text>'</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>check X3D source or VRML output to find erroneous </xsl:text> <xsl:value-of select="node"/> </xsl:otherwise> </xsl:choose> <xsl:text>]</xsl:text> </xsl:message> </xsl:template> </xsl:stylesheet>

[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources

(C) A. Eliëns 9/8/2006

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.