Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help Passing Param of string length and using it in a predicate He

From: Russ@-----------.---------.---
To: NULL
Date: 6/2/2006 2:50:00 AM


  Hi All,

  please bare with me I have been learning xls and xpath now for 5 days and 
have not got to gripps with all the lingo yet :)

    Bascially I have 2 templates one calling the other:

         <xsl:for-each select="hea/Batch/Rec[not(listID = 
preceding-sibling::Rec/listID)]">

         <xsl:call-template name="Batch">
            <xsl:with-param name="DataType" select="listID"/>
         </xsl:call-template>

      </xsl:for-each>

the above calls the template below:

<xsl:template name="Batch">
<xsl:param name="DataType"></xsl:param>



<table>
 <tr>
   <td colspan="2"><xsl:value-of select="$DataType"/></td>
 </tr>
 <tr>
  <td>Daily report</td> 
  <td>Too Date Report</td>
 </tr>
 <tr>
  <td>

    <table width="100%" border="1" cellPadding="2" cellSpacing="0" 
bordercolor="#333366" style="border-style=solid; border-width=1px; 
border-color=black;">
  
      <tr bgcolor="#00CCFF">
        <th align="left">Outcome</th>
        <th align="left">Description</th>
        <th align="left">Freq</th>
        <th align="left">%</th>
      </tr>

      <xsl:variable name="TFreq" select="sum(hea/Batch/Rec[sec='Daily' and 
listID = String($DataType)]/Freq)"/>

      <xsl:for-each select="hea/Batch/Rec[sec='Daily' and listID = 
$DataType]">

          <tr bgcolor="#CBFFA8">
            <td><xsl:value-of select="Outcome"/></td>
            <td><xsl:value-of select="Descript"/></td>
            <td><xsl:value-of select="Freq"/></td>
            <td><xsl:value-of select='format-number((Freq div $TFreq), 
"00.##%")'/></td>     
          </tr>

      </xsl:for-each>
      
      <tr bgcolor="#00CCFF">
        <td>Total</td>
        <td> </td>
        <td align="right" ><xsl:value-of select="$TFreq"/></td>
        <td>100.00%</td>
      </tr>
    </table>
  </td>
 </tr>
</table>  

</xsl:template>


Ok My problem is I am passing a param that is equal to the value of an 
element ie CAP1.

I am then using this in the predicates is the form of <Element> = $Param.

$Param does work if its a literal string I am passing eg 'CAP1' but because 
I am just passing CAP1 it does not work. 

I have tried using concat to add the ' to the string before I pass it to the 
param and using it after the param is asined in predicate but nothing I try 
seams to work. 

I am sure this is a simple problem to solve as to me this is an obvious use 
of xsl.

please help I have googled my brains out with no luck


Thanks in advance Russ


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent