xsl-list
[Top] [All Lists]

select an element

2005-05-17 08:45:00
I have a xml file  which has an element ENTRY_FORM
"á". And I have an interface written with php, code is like this:
$word="á";
$params=array("wordLength" => $length, "Kentry" => $word );
$result =xslt_process($xp,$xml_file, $xslt_file, NULL, $arg_buffer, $params)

The xslt is "Sablotron Version 1.0.2.

If my search.xsl like this:
<xsl:stylesheet  version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr
ansform">
<xsl:output method="xml" indent="yes" encoding="iso-8859-1" />

<xsl:param  name="Kentry" select="'&#x00E1;'"/>
<xsl:param name="wordLength" />

<xsl:template match="/reportname"  xml:space="preserve">

<xsl:for-each select="Entry">

<xsl:variable name="Wentry"><xsl:value-of select="ENTRY_FORM"/></xsl:va=
riable>

<xsl:variable name="Centry" select="substring($Wentry,1,1)"/>

<xsl:variable name="Kentry1" select="'&#x00E1;'"/>

         <xsl:if test="$Centry=$Kentry1">

          <option value="{position()+1}">

          <xsl:value-of select="$Wentry" />
          </option>

         </xsl:if>

</xsl:for-each>

I force the Kentry to be "&#x00E1;" and Entry_form to be Length 1. Then it
works. But when I put them here:

<xsl:param  name="Kentry" select="'&#x00E1;'"/>
<xsl:param name="wordLength" />

<xsl:template match='*|@*'>
<xsl:copy>
<xsl:for-each select="/reportname/Entry[substring(ENTRY_FORM,1,1) =
substring($Kentry,1,$wordLength)]">
    
<Entry>
<xsl:copy-of select='node()|@*' />
</Entry>
</xsl:for-each>
</xsl:copy>
</xsl:template>

It doesn't work. Or If I put  <xsl:for-each
select="/reportname/Entry[substring(ENTRY_FORM,1,$wordLength) =
substring($Kentry,1,$wordLength)]"> there, it doesn't work either. I
used :<xsl:value-of select="string-length($Kentry)"/> to check the
$Kentry length, it is 8. It supposed to be working, but it did not.

Can someone give me some hint? Thanks!

Helen

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>