You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Frédéric Tremblay <ft...@eonmediainc.com> on 2002/03/19 16:59:35 UTC
access problem with document() function
Hi,
i use to 2 XML document with 1 XSL document. The first XLM is a JSP
page (test.jsp)
and the second is a pure XML (test.xlm) access via document() function.
So i want to access an element in test.xlm with an attibute defined
in test.jsp but this doesn't
work: (see the files...)
...
this work well:
CLIENT: <xsl:value-of
select="$externXML/usClient/client[@zip='67890']"/><br/> <!-- XYZ -->
but this doesn't work:
ZIP: <xsl:value-of select="$jspZip"/><br/> <!-- 67890 the good
value... -->
CLIENT: <xsl:value-of
select="$externXML/usClient/client[@zip=$jspZip]"/><br/> <!-- NOTHING! -->
What is the problem?
Thanks in advance,
Fred
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////
/// test.jsp
<%
String strZIP = "67890";
%>
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"
href="http://localhost:8080/drillDown/test.xsl"?>
<test>
<zip>
<%=strZIP%>
</zip>
</test>
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////
/// test.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"
href="http://localhost:8080/drillDown/test.xsl"?>
<usClient>
<client zip="12345">
ABC
</client>
<client zip="67890">
XYZ
</client>
</usClient>
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////
/// test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<body>
<xsl:variable name="externXML"
select="document('http://localhost:8080/drillDown/test.xml')"></xsl:variable
>
<xsl:variable name="jspZip"
select="test/zip"></xsl:variable>
ZIP: <xsl:value-of select="$jspZip"/><br/>
CLIENT: <xsl:value-of
select="$externXML/usClient/client[@zip=$jspZip]"/><br/>
CLIENT: <xsl:value-of
select="$externXML/usClient/client[@zip='67890']"/><br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////