Bonjour,
Voici mon problème :
Fichier XML :
<document xmlns="http://www.test.com/ui">
</document>
Fichier XSL :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ui="http://www.test.com/ui"
exclude-result-prefixes="xsl">
<xsl:output indent="yes" cdata-section-elements="script"/>
<xsl:template match="ui:document">
<jsp:root version="1.2"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jstl/core">
<c:set var="CONTEXT" value="${{sessionScope.CONTEXT}}" />
<xsl:variable name="lang"><xsl:text disable-output-escaping="yes"><![CDATA[<c:out value="${CONTEXT.language}" />]]></xsl:text></xsl:variable>
<html>
<xsl:attribute name="lang">
<xsl:value-of select="$lang" disable-output-escaping="yes" />
</xsl:attribute>
<xsl:value-of select="$lang" disable-output-escaping="yes" />
</html>
</jsp:root>
</xsl:template>
</xsl:stylesheet>
Ce qui me génère :
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" version="1.2">
<c:set value="${sessionScope.CONTEXT}" var="CONTEXT"/>
<html lang="<c:out value="${CONTEXT.language}" />"><c:out value="${CONTEXT.language}" /></html>
</jsp:root>
Question : Pourquoi les caractères dans l'attribut lang de la balise HTML sont escapés alors qu'en dehors de l'attribut, tout est OK.
Ce que j'aimerai obtenir :
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jstl/core" version="1.2">
<c:set value="${sessionScope.CONTEXT}" var="CONTEXT"/>
<html lang="<c:out value="${CONTEXT.language}" />"><c:out value="${CONTEXT.language}" /></html>
</jsp:root>
Merci d'avance si vous avez des pistes à me donner.
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Received on Fri Sep 15 16:09:33 2006