Project

Profile

Help

who can return the path and no the text

Added by Anonymous over 17 years ago

Legacy ID: #3961557 Legacy Poster: CoucouA (coucou3011)

Hello, The result returned by the follow code is Aaaa oui, but I would to show the path: /requete and no the text : Aaaa oui It is possible because I select the "document('requete.xml')/requete <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" 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="varReq" select="document('requete.xml')/requete"/> </xsl:call-template> </table> </body> </html> </xsl:template> <xsl:template name ="doc" match="LISTE-A" > <xsl:param name=" varReq"/> <value-of select="$varReq"/> </xsl:template> </xsl:stylesheet> the XML file for the document requete.xml is <?xml version="1.0" encoding='ISO-8859-1'?> <requete> <DEP>Aaaa</DEP> <ANI>oui</ANI> </requete>


Replies (3)

Please register to reply

RE: who can return the path and no the text - Added by Anonymous over 17 years ago

Legacy ID: #3961577 Legacy Poster: Michael Kay (mhkay)

I assume that by <value-of select="$varReq"/> you really meant <xsl:value-of select="$varReq"/> The xsl:value-of instruction displays the string value of a node. To display a path to a node, try googling for "XSLT display path to node", or use the extension function saxon:path(). Please note that this list is not here to provide general XSLT coding advice to beginners. As the name of the list implies, it's there to help you with problems that are specific to your use of the Saxon product. A better place for general purpose XSLT help is the xsl-list at mulberrytech.com

RE: who can return the path and no the text - Added by Anonymous over 17 years ago

Legacy ID: #3961695 Legacy Poster: CoucouA (coucou3011)

In http://saxon.sourceforge.net/saxon7.8/extensions.html#path In haven't found an example, so I try to insert saxon:path() as follow <xsl:param name=" varReq" select="saxon:path()"/> <xsl:value-of select="$requete"/> but I receive the same result

RE: who can return the path and no the text - Added by Anonymous over 17 years ago

Legacy ID: #3962038 Legacy Poster: Michael Kay (mhkay)

That's because saxon:path returns a path to the context node, whereas you want a path to $requete. Try select="$requete/saxon:path()"

    (1-3/3)

    Please register to reply