</xsl:apply-templates>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="skin">
<xsl:text>skin [ </xsl:text>
<xsl:apply-templates select="skin/*"></xsl:apply-templates>
<xsl:text>] </xsl:text>
</xsl:if>
<xsl:if test="viewpoints/* or Viewpoint">
<xsl:text>viewpoints [ </xsl:text>
<xsl:apply-templates select="viewpoints/*"></xsl:apply-templates>
<xsl:apply-templates select="Viewpoint"></xsl:apply-templates>
<xsl:text>] </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 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>"</xsl:text>
<xsl:value-of select="@url" />
<xsl:text>"</xsl:text>
<xsl:text> </xsl:text>
</xsl:when>
<!-- url quote marks not needed -->
<xsl:when test="@url">
<xsl:value-of select="@url" />
<xsl:text> </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>"</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 </xsl:text> -->
<xsl:when test="(normalize-space(.)='' or normalize-space(.)=' ') and following::field"></xsl:when><!--<xsl:text>// stripped LF after field </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> </xsl:text>
<xsl:if test="not(starts-with(normalize-space(.),'"'))">
<xsl:text>"</xsl:text>
</xsl:if>
</xsl:if>
<xsl:text> ] </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> </xsl:text> -->
<xsl:call-template name="print-indent"></xsl:call-template>
<xsl:text>} </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="<xsl:text> </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
notDefaultFieldValue2 and
notDefaultFieldValue4 and
notDefaultFieldValue6 and
notDefaultHAnim and
<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> </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>" found </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="<xsl:text> </xsl:text> -->
<!-- <xsl:text> # fieldName </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<!-- <xsl:text> # matchName </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<xsl:variable name="PROTOdeclareAncestorField" select="ancestor::*[local-name()='ProtoDeclare']/field" />
<!-- <xsl:if test="PROTOdeclareAncestorField"> # ProtoDeclare ancestor field "<xsl:text>" found </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=
<xsl:variable name="parentType" select="local-name(//ProtoDeclare[@name=parentNodeName]/node()[local-name()!='field'])" />
<!-- ExternProtoDeclared ProtoInstance -->
<xsl:variable name="EPnodeName" select="//ExternProtoDeclare[@name=nodeName2]/@name" />
<xsl:variable name="EPnodeType" select="//ExternProtoDeclare[@name=nodeName2]/@nodeType" />
<xsl:variable name="EPfieldType" select="//ExternProtoDeclare[@name=nodeName2]/field[@name=
<!-- debug diagnosis statements -->
<!-- <xsl:if test="nodeName"># <xsl:text> </xsl:text></xsl:if> -->
<!-- <xsl:text># nodeName </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<!-- <xsl:text># nodeName2 </xsl:text><xsl:value-of select="nodeName2"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># local-name() </xsl:text><xsl:value-of select="local-name()"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># local-name(..) </xsl:text><xsl:value-of select="local-name(..)"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># EPnodeName </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<!-- <xsl:text># parentNodeName </xsl:text><xsl:value-of select="parentNodeName"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># nodeType </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<!-- <xsl:text># parentType </xsl:text><xsl:value-of select="parentType"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># EPnodeType </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<!-- <xsl:text># EPparentType </xsl:text><xsl:value-of select="EPparentType"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># @nodeType </xsl:text><xsl:value-of select="@nodeType"/><xsl:text> </xsl:text> -->
<!-- <xsl:text># EPfieldType </xsl:text><xsl:value-of select="<xsl:text> </xsl:text> -->
<xsl:variable name="BooleansTypes"
select="(nodeType ='Booleans') or (nodeType='XvlShell' or
<xsl:variable name="MFtypes"
select="(nodeType ='Colors') or (nodeType ='Integers') or
(nodeType ='Times') or (nodeType ='Vector3FloatArray') or
(EPnodeType='Floats') or (EPnodeType='Rotations') or (EPnodeType='Vector2FloatArray') or (
<xsl:variable name="ExtensionMFtypes"
select="
((local-name(..)='GeoElevationGrid' or nodeType='GeoElevationGrid' or nodeType='GeoPositionInterpolator' or nodeType='Joint' or nodeType='Segment' or EPnodeType='Vector3FloatArray') or
((local-name(..)='Joint' or EPnodeType='Joint' or @nodeType='Joint') and
(local-name()='skinCoordIndex' or local-name()='skinCoordWeight') or
((local-name(..)='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 EPnodeType='GeoElevationGrid' or @nodeType='GeoElevationGrid') and
(local-name()='geoGridOrigin' or local-name()='xSpacing' or local-name()='zSpacing')) or
((local-name(..)='GeoLocation' or EPnodeType='GeoLocation' or @nodeType='GeoLocation') and
local-name()='geoCoords') or
((local-name(..)='GeoLOD' or EPnodeType='GeoLOD' or @nodeType='GeoLOD') and
local-name()='center') or
((local-name(..)='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 EPnodeType='GeoOrigin' or @nodeType='GeoOrigin') and
local-name()='geoCoords') or
((local-name(..)='GeoPositionInterpolator' or EPnodeType='GeoPositionInterpolator' or @nodeType='GeoPositionInterpolator') and
local-name()='geoValue') or
((local-name(..)='GeoTouchSensor' or EPnodeType='GeoTouchSensor' or @nodeType='GeoTouchSensor') and
(local-name()='hitNormal' or local-name()='hitGeoCoordinate' or local-name()='hitTexCoord')) or
((local-name(..)='GeoViewpoint' or EPnodeType='GeoViewpoint' or @nodeType='GeoViewpoint') and
(local-name()='position' or local-name()='description'))" />
<xsl:variable name="GeoSpatialMFStringTypes"
select="((local-name(..)='GeoCoordinate' or EPnodeType='GeoCoordinate' or @nodeType='GeoCoordinate') and
(local-name()='geoSystem' or local-name()='point')) or
((local-name(..)='GeoElevationGrid' or EPnodeType='GeoElevationGrid' or @nodeType='GeoElevationGrid') and
local-name()='geoSystem') or
((local-name(..)='GeoInline' or EPnodeType='GeoInline' or @nodeType='GeoInline') and
local-name()='url') or
((local-name(..)='GeoLocation' or EPnodeType='GeoLocation' or @nodeType='GeoLocation') and
local-name()='geoSystem') or
((local-name(..)='GeoLOD' or EPnodeType='GeoLOD' or @nodeType='GeoLOD') and
(contains(local-name(),'Url') or local-name()='geoSystem')) or
((local-name(..)='GeoMetadata' or EPnodeType='GeoMetadata' or @nodeType='GeoMetadata') and
(local-name()='url' or local-name()='summary')) or
((local-name(..)='GeoOrigin' or EPnodeType='GeoOrigin' or @nodeType='GeoOrigin') and
local-name()='geoSystem') or
((local-name(..)='GeoPositionInterpolator' or EPnodeType='GeoPositionInterpolator' or @nodeType='GeoPositionInterpolator') and
(local-name()='geoSystem' or local-name()='keyValue')) or
((local-name(..)='GeoTouchSensor' or EPnodeType='GeoTouchSensor' or @nodeType='GeoTouchSensor') and
local-name()='geoSystem') or
((local-name(..)='GeoViewpoint' or EPnodeType='GeoViewpoint' or @nodeType='GeoViewpoint') and
(local-name()='geoSystem' or local-name()='navType'))" />
<xsl:variable name="HAnimSFStringTypes"
select="((local-name(..)='Joint' or EPnodeType='Joint' or @nodeType='Joint') and
local-name()='name') or
((local-name(..)='Segment' or EPnodeType='Segment' or @nodeType='Segment') and
local-name()='name') or
((local-name(..)='Site' or EPnodeType='Site' or @nodeType='Site') and
local-name()='name') or
((local-name(..)='Displacer' or EPnodeType='Displacer' or @nodeType='Displacer') and
local-name()='name') or
((local-name(..)='Humanoid' or EPnodeType='Humanoid' or @nodeType='Humanoid') and
(local-name()='name' or local-name()='version'))" />
<xsl:variable name="HAnimMFStringTypes"
select="((local-name(..)='Humanoid' or EPnodeType='Humanoid' or @nodeType='') and
local-name()='info')" />
<xsl:variable name="DisJavaVrmlSFStringTypes"
select="((local-name(..)='EspduTransform' or EPnodeType='EspduTransform' or @nodeType='EspduTransform' or
local-name(..)='ReceiverPdu' or EPnodeType='ReceiverPdu' or @nodeType='ReceiverPdu' or
local-name(..)='SignalPdu' or EPnodeType='SignalPdu' or @nodeType='SignalPdu' or
local-name(..)='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 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 " quotation marks " -->
<xsl:when test="((local-name(..)='Anchor' or EPnodeType='Anchor' or @nodeType='Anchor') and
local-name()='description') or
((local-name(..)='AudioClip' or EPnodeType='AudioClip' or @nodeType='AudioClip') and
local-name()='description') or
((local-name(..)='Fog' or EPnodeType='Fog' or @nodeType='Fog') and
local-name()='fogType') or
((local-name(..)='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle') and
(local-name()='language' or local-name()='style')) or
((local-name(..)='Viewpoint' or EPnodeType='Viewpoint' or @nodeType='Viewpoint') and
local-name()='description') or
((local-name(..)='WorldInfo' or EPnodeType='WorldInfo' or @nodeType='WorldInfo') and
local-name()='title') or
HAnimSFStringTypes or
nodeType = 'String') or
(EPfieldType = 'String') or
(EPnodeType = 'Booleans') or
(BooleansTypes)
">
<xsl:if test="(local-name()='fogType' or local-name()='style') and (
<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> "" </xsl:text></xsl:when>
<!-- output SFString. no need to wrap quotes -->
<xsl:when test="starts-with(normalize-space(.),'"')"> <xsl:text> </xsl:text></xsl:when>
<xsl:when test='starts-with(.,"'")'> "<xsl:text>" </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>" </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- take care of some special MFString types by adding enclosing " " marks -->
<xsl:when test="((local-name(..)='FontStyle' or EPnodeType='FontStyle' or @nodeType='FontStyle') and
(local-name()='family' or local-name()='justify')) or
((local-name(..)='NavigationInfo' or EPnodeType='NavigationInfo' or @nodeType='NavigationInfo') and
local-name()='type')">
<xsl:if test="(local-name()='justify') and (
<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> [ "" ] </xsl:text></xsl:when>
<!-- output MFString. don't modify quotes if some are there already -->
<xsl:when test="contains(.,'"')"> [ <xsl:text> ] </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: "</xsl:text><xsl:value-of select="concat(normalize-space(translate(.,'"',' ')),' ')"/><xsl:text>" </xsl:text> -->