svghmi/gen_index_xhtml.xslt
branchwxPython4
changeset 3582 7dcd0de97e6f
parent 3558 f5850ce25caf
child 3615 5c983ead9db0
equal deleted inserted replaced
3581:5a0f7fcf9a8f 3582:7dcd0de97e6f
   158         <xsl:value-of select="$parentpath"/>
   158         <xsl:value-of select="$parentpath"/>
   159       </xsl:with-param>
   159       </xsl:with-param>
   160     </xsl:apply-templates>
   160     </xsl:apply-templates>
   161   </xsl:template>
   161   </xsl:template>
   162   <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"/>
   162   <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"/>
       
   163   <xsl:variable name="newline">
       
   164     <xsl:text>
       
   165 </xsl:text>
       
   166   </xsl:variable>
       
   167   <xsl:variable name="twonewlines" select="concat($newline,$newline)"/>
   163   <xsl:template mode="parselabel" match="*">
   168   <xsl:template mode="parselabel" match="*">
   164     <xsl:variable name="label" select="@inkscape:label"/>
   169     <xsl:variable name="part" select="@inkscape:label"/>
       
   170     <xsl:variable name="desc" select="svg:desc"/>
       
   171     <xsl:variable name="len" select="string-length($part)"/>
       
   172     <xsl:variable name="has_continuation" select="substring($part,$len,1)='\'"/>
       
   173     <xsl:variable name="label">
       
   174       <xsl:choose>
       
   175         <xsl:when test="$has_continuation">
       
   176           <xsl:variable name="_continuation" select="substring-before($desc, $twonewlines)"/>
       
   177           <xsl:variable name="continuation">
       
   178             <xsl:choose>
       
   179               <xsl:when test="$_continuation">
       
   180                 <xsl:value-of select="$_continuation"/>
       
   181               </xsl:when>
       
   182               <xsl:otherwise>
       
   183                 <xsl:value-of select="$desc"/>
       
   184               </xsl:otherwise>
       
   185             </xsl:choose>
       
   186           </xsl:variable>
       
   187           <xsl:value-of select="concat(substring($part,1,$len - 1),translate($continuation,$newline,''))"/>
       
   188         </xsl:when>
       
   189         <xsl:otherwise>
       
   190           <xsl:value-of select="$part"/>
       
   191         </xsl:otherwise>
       
   192       </xsl:choose>
       
   193     </xsl:variable>
   165     <xsl:variable name="id" select="@id"/>
   194     <xsl:variable name="id" select="@id"/>
   166     <xsl:variable name="description" select="substring-after($label,'HMI:')"/>
   195     <xsl:variable name="description" select="substring-after($label,'HMI:')"/>
   167     <xsl:variable name="_args" select="substring-before($description,'@')"/>
   196     <xsl:variable name="_args" select="substring-before($description,'@')"/>
   168     <xsl:variable name="args">
   197     <xsl:variable name="args">
   169       <xsl:choose>
   198       <xsl:choose>
   303                 </xsl:choose>
   332                 </xsl:choose>
   304               </xsl:if>
   333               </xsl:if>
   305             </path>
   334             </path>
   306           </xsl:if>
   335           </xsl:if>
   307         </xsl:for-each>
   336         </xsl:for-each>
   308         <xsl:if test="svg:desc">
   337         <xsl:choose>
   309           <desc>
   338           <xsl:when test="$has_continuation">
   310             <xsl:value-of select="svg:desc/text()"/>
   339             <xsl:variable name="_continuation" select="substring-after($desc, $twonewlines)"/>
   311           </desc>
   340             <xsl:if test="$_continuation">
   312         </xsl:if>
   341               <desc>
       
   342                 <xsl:value-of select="$_continuation"/>
       
   343               </desc>
       
   344             </xsl:if>
       
   345           </xsl:when>
       
   346           <xsl:otherwise>
       
   347             <xsl:if test="$desc">
       
   348               <desc>
       
   349                 <xsl:value-of select="$desc/text()"/>
       
   350               </desc>
       
   351             </xsl:if>
       
   352           </xsl:otherwise>
       
   353         </xsl:choose>
   313       </widget>
   354       </widget>
   314     </xsl:if>
   355     </xsl:if>
   315   </xsl:template>
   356   </xsl:template>
   316   <xsl:template mode="genlabel" match="arg">
   357   <xsl:template mode="genlabel" match="arg">
   317     <xsl:text>:</xsl:text>
   358     <xsl:text>:</xsl:text>
   369       <xsl:value-of select="."/>
   410       <xsl:value-of select="."/>
   370       <xsl:text>" </xsl:text>
   411       <xsl:text>" </xsl:text>
   371     </xsl:for-each>
   412     </xsl:for-each>
   372     <xsl:text>
   413     <xsl:text>
   373 </xsl:text>
   414 </xsl:text>
       
   415     <xsl:if test="text()">
       
   416       <xsl:value-of select="text()"/>
       
   417       <xsl:text>
       
   418 </xsl:text>
       
   419     </xsl:if>
   374     <xsl:apply-templates mode="testtree" select="*">
   420     <xsl:apply-templates mode="testtree" select="*">
   375       <xsl:with-param name="indent">
   421       <xsl:with-param name="indent">
   376         <xsl:value-of select="concat($indent,'&gt;')"/>
   422         <xsl:value-of select="concat($indent,'&gt;')"/>
   377       </xsl:with-param>
   423       </xsl:with-param>
   378     </xsl:apply-templates>
   424     </xsl:apply-templates>
  5598 </xsl:text>
  5644 </xsl:text>
  5599     <xsl:text>        dispatch(value) {
  5645     <xsl:text>        dispatch(value) {
  5600 </xsl:text>
  5646 </xsl:text>
  5601     <xsl:text>            this.disabled = !Number(value);
  5647     <xsl:text>            this.disabled = !Number(value);
  5602 </xsl:text>
  5648 </xsl:text>
       
  5649     <xsl:text>
       
  5650 </xsl:text>
       
  5651     <xsl:text>            // TODO : use RequestAnimate and animate()
       
  5652 </xsl:text>
       
  5653     <xsl:text>
       
  5654 </xsl:text>
  5603     <xsl:text>            this.update_state();
  5655     <xsl:text>            this.update_state();
  5604 </xsl:text>
  5656 </xsl:text>
  5605     <xsl:text>        }
  5657     <xsl:text>        }
  5606 </xsl:text>
  5658 </xsl:text>
  5607     <xsl:text>}
  5659     <xsl:text>}
  6345 </xsl:text>
  6397 </xsl:text>
  6346     <xsl:text>            }
  6398     <xsl:text>            }
  6347 </xsl:text>
  6399 </xsl:text>
  6348     <xsl:text>        }
  6400     <xsl:text>        }
  6349 </xsl:text>
  6401 </xsl:text>
       
  6402     <xsl:text>        // TODO : use RequestAnimate and animate()
       
  6403 </xsl:text>
  6350     <xsl:text>    }
  6404     <xsl:text>    }
  6351 </xsl:text>
  6405 </xsl:text>
  6352     <xsl:text>
  6406     <xsl:text>
  6353 </xsl:text>
  6407 </xsl:text>
  6354     <xsl:text>    on_click(evt) {
  6408     <xsl:text>    on_click(evt) {