[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

select an element

Subject: select an element
From: Honglei Chen <hlchen@xxxxxxxxx>
Date: Tue, 17 May 2005 10:45:00 -0500
x00e1
I have a xml file  which has an element ENTRY_FORM
"&#x00E1;". And I have an interface written with php, code is like this:
$word="&#x00E1;";
$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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.