Subject: [xsl] select an element From: Honglei Chen <hlchen@xxxxxxxxx> Date: Tue, 17 May 2005 10:45:00 -0500 |
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="'á'"/> <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="'á'"/> <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 "á" and Entry_form to be Length 1. Then it works. But when I put them here: <xsl:param name="Kentry" select="'á'"/> <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Correction, Aron Bock | Thread | Re: [xsl] select an element, David Carlisle |
Re: [xsl] time difference help, Jeni Tennison | Date | Re: [xsl] select an element, David Carlisle |
Month |