Posting of the incomplete result
Added by Anonymous about 18 years ago
Legacy ID: #3958942 Legacy Poster: CoucouA (coucou3011)
Hello, When I run my following code I haven’t the error message, but it does not post me the complete result Normally, I must receive the following result .//ANI = oui Numbre Num of A 1 20-11 2 20-12 But I received only .//ANI = oui Numbre Num of A Please can you tell me why ? My code XSLT <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" > <xsl:output method="html" media-type="text/html; charset=ISO-8859-1" version="4.0"/> <xsl:template match="/"> <html> <body> <table border="0" width="*" > <tr> <th>Numbre </th> <th>Num of A</th> </tr> <xsl:call-template name="doc"> <xsl:with-param name="varReq2" select= "string ('.//ANI = oui' )"/> </xsl:call-template> </table> </body> </html> </xsl:template> <xsl:template name ="doc" match="LISTE-A" > <xsl:param name="requete"/> <xsl:param name="varReq2"/> <xsl:value-of select="$varReq2"/> <!-- this case is ok, the value of varReq2 is shown as String and not boolean --> <xsl:for-each select="//A"> <xsl:if test="select='saxon:evaluate($varReq2)'"> <tr><td><xsl:variable name="number" /> <xsl:number level="any" from="LISTE-A"/> <xsl:value-of select="$number"/> </td> <!-- this column contains numbers going of 1 until the number of result--> <td><font color="#FF8040"> <xsl:value-of select="NUM"/></font></td> <!-- this column must contains the num of when saxon:evaluate($varReq2) =true--> <td><font color="blue">ANI</font></td> <td><xsl:value-of select="saxon:evaluate($varReq2)" /></td> </tr> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> My XML file <?xml version="1.0" encoding='ISO-8859-1'?> <?xml-stylesheet type="text/xsl" href="essai.xsl"?> <LISTE-A><A> <NUM>20-10</NUM> <C> <ANI>non</ANI> </C> <S><SIT> <DEP>Aaaa</DEP> <COM>BB</COM> </SIT> </S> </A> <A> <NUM>20-11</NUM> <C> <ANI>oui</ANI> </C> <S><SIT> <DEP>Abbb</DEP> <COM>BB</COM> </SIT> </S> </A> <A> <NUM>20-12</NUM> <C> <ANI>oui</ANI> </C> <S><SIT> <DEP>Aaaa</DEP> <COM>BB</COM> </SIT> </S> </A> </LISTE-A>
Replies (6)
Please register to reply
RE: Posting of the incomplete result - Added by Anonymous about 18 years ago
Legacy ID: #3958961 Legacy Poster: Michael Kay (mhkay)
You might find it helpful to debug your XPath expressions before you use them in saxon:evaluate(). Your expression .//ANI = oui should be .//ANI = 'oui'
RE: Posting of the incomplete result - Added by Anonymous about 18 years ago
Legacy ID: #3959133 Legacy Poster: CoucouA (coucou3011)
I have try to make .//ANI = 'oui' as follow <xsl:with-param name="varReq2" select= "string ('.//ANI = 'oui' ')"/> but Ireceived the error message XPath syntax error in { string <'.//ANI = 'oui' >}:expected ">", found name "oui" and when I make the follow instraction <xsl:with-param name="varReq2" select= ".//ANI = 'oui' "/> I received the boolean value of varReq2,but I would to keep the value in string
RE: Posting of the incomplete result - Added by Anonymous about 18 years ago
Legacy ID: #3959149 Legacy Poster: Michael Kay (mhkay)
Well of course you have to escape quotation marks if you include one string inside another. (Please, this is very elementary - do you really need help with such simple problems?) So you could write select= "string ('.//ANI = ''oui'' ')" but you don't need to write string('x'), it's the same as 'x'. In fact I would write this as <xsl:with-param name="varReq2" as="xs:string">.//ANI = 'oui'</xsl:with-param> to avoid the problems with quotation marks. (Of course you have to declare xmlns:xs="http://www.w3.org/2001/XMLSchema")
RE: Posting of the incomplete result - Added by Anonymous about 18 years ago
Legacy ID: #3959189 Legacy Poster: CoucouA (coucou3011)
Thank you, I have write the both instructions :declaration in stylesheet and <xsl:with-param name="varReq2" as="xs:string">.//ANI = 'oui'</xsl:with-param> but the same problem is presented, i.e. I don't receive the result complet
RE: Posting of the incomplete result - Added by Anonymous about 18 years ago
Legacy ID: #3959202 Legacy Poster: Michael Kay (mhkay)
The following code is nonsense: <xsl:if test="select='saxon:evaluate($varReq2)'"> if is testing whether the context node has a child named "select" whose value is the string 'saxon:evaluate($varReq2)' it should be <xsl:if test="saxon:evaluate($varReq2)">
RE: Posting of the incomplete result - Added by Anonymous about 18 years ago
Legacy ID: #3959246 Legacy Poster: CoucouA (coucou3011)
Thank very much
Please register to reply