XML, XSL et les liens hypertextes

Valerie -  
 Valérie -
J'essaye d'attribuer une valeur (que je récupère de mon document XML) à un lien hypertexte dans mon fichier XSL afin d'avoir un lien hypertexte dans ma page JSP. Or il semblerais que je ne peux pas : voici un extrait de mes 3 fichiers :
--------------------
xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<projets>
<projet>
<nom id="aces">F_PAC</nom>
<logo>images/BandeauxLogos/Demeter15.gif</logo>
</projet>
</projets>
---------------------
xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">

<xsl:template match="projets">
<TABLE align="left" cellspacing="2" cellpadding="0" border="0" width="100%">
<xsl:for-each select="projet">
<TR><TD>
<A href="accueilprojet.html?PROJET="<xsl:value-of select="nom"/>" target = "main" onmouseover="imageProjet(''<xsl:value-of select="logo"/>'')"></A>
</TD></TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>
---------------------------
mon erreur :

javax.servlet.ServletException: org.apache.xalan.xslt.XSLProcessorException: element type "A" must be followed by either attribute specifications, ">" or "/>".

ou

javax.servlet.ServletException: org.apache.xalan.xslt.XSLProcessorException: The value of attribute "href" must not contain the '<' character. (si j'ote les quotes avant le <)

Si vous avez des exemples....d'avance merci !!!

2 réponses

  1. Br@scoo
     
    C normal que cela ne fonctionne pas.
    J'ai corrigé, si c'est ce que tu cherche, essai ca pour ton fichier xsl :
    (j'ai mis en commentaire la partie qui ne fonctionne pas...)

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="projets">
    <TABLE align="left" cellspacing="2" cellpadding="0" border="0" width="100%">
    <xsl:for-each select="projet">
    <TR><TD>

    <xsl:element name="A">
    <xsl:attribute name="HREF">
    accueilprojet.html?PROJET=
    <xsl:value-of select="nom" disable-output-escaping="yes"/>
    </xsl:attribute>
    <xsl:attribute name="onmouseover">
    imageProjet('
    <xsl:value-of select="logo"/>'
    ')
    </xsl:attribute>
    </xsl:element>
    Le lien

    <!--
    <A href="accueilprojet.html?PROJET="<xsl:value-of select="nom"/>" target = "main"

    onmouseover="imageProjet(''<xsl:value-of select="logo"/>'')"></A>
    -->

    </TD></TR>
    </xsl:for-each>
    </TABLE>
    </xsl:template>
    </xsl:stylesheet>

    @+ Valérie !

    Br@scoo
    1
  2. Valérie
     
    Merci beaucoup, ça fonctionne parfaitement ;-)

    0