Bbeps2 form input.xsl

From UGP-Wiki

Jump to: navigation, search

[edit] Example File

  • Simple example of app_form_input.xsl
  • Basically, outputs each elements name and value in a "name=value" format
  • Includes one example of special formatting for runid
<xsl:stylesheet version = '1.0' 
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<!-- **********************************************************************
     the following line is needed or else we get white space in the output
     that we do not ask for or want 
     ********************************************************************** -->

<xsl:strip-space elements="*" />
<xsl:output method="text" omit-xml-declaration="yes"/>

<!-- **********************************************************************
* root template
* xsl for input for bbeps2 appForm
* this file has some leftover formatting from pbeps2 that can be removed in the future, for now it works fine for bbeps2
*************************************************************************** -->

<xsl:template match="/">

   <xsl:text>&input2
</xsl:text>

   <xsl:for-each select="/app/element">

      <xsl:variable name="myName">
         <xsl:value-of select="@name"/>
      </xsl:variable>

      <!-- ************************************************************
      * namelist elements of the form:   name = value,
      ************************************************************* -->

      <!-- ************************************************************
      * name
      ************************************************************* -->

            <xsl:value-of select="@name"/>


      <!-- ************************************************************
      * =
      ************************************************************* -->

      <xsl:text> = </xsl:text>

      <!-- ************************************************************
      * value
      ************************************************************* -->

      <xsl:choose>

         <xsl:when test="@name='runid'">
            <xsl:apply-templates select="."/>
         </xsl:when>

         <xsl:otherwise>
            <xsl:value-of select="child::value"/>
         </xsl:otherwise>

      </xsl:choose>

      <!-- ************************************************************
      * ,
      ************************************************************* -->

      <xsl:text>,
</xsl:text>

   </xsl:for-each>

   <xsl:text>/

<!-- **********************************************************************
* runid  
*************************************************************************** -->

<xsl:template match="element[@name='runid']">

   <xsl:text>'</xsl:text>
      <xsl:value-of select="child::value"/>
   <xsl:text>'</xsl:text>

</xsl:template>
</xsl:text>

</xsl:template>

</xsl:stylesheet>
Personal tools