When posting a problem to the list, it would be much better if you could
post a minimal stylesheet and xml, rather than jsp that we have to
translate into the correct input. After all, this is not a JSP list!
It looks to me like the problem is here:
<test>
<zip>
<%=strZIP%>
</zip>
</test>
If I understand this correctly, this results in the following XML:
<test>
<zip>
67890
</zip>
</test>
So this variable definition:
<xsl:variable name="jspZip" select="test/zip"/>
Results in a variable that includes all of the PCDATA in the text,
including whitespace. You might want to change your variable definition to
the following:
<xsl:variable name="jspZip" select="normalize-space(test/zip)"/>
You could also remove the whitespace from your XML:
<test>
<zip><%=strZIP%></zip>
</test>
In the future, please post concise input, as it makes it much easier for
others to figure out what's going on.
Dave
Fr�d�ric
Tremblay To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED] cc: (bcc: David N
Bertoni/Cambridge/IBM)
diainc.com> Subject: access problem with
document() function
03/19/2002 07:59
AM
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/[EMAIL PROTECTED]'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/[EMAIL PROTECTED]"/><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/[EMAIL PROTECTED]"/><br/>
CLIENT: <xsl:value-of
select="$externXML/usClient/[EMAIL PROTECTED]'67890']"/><br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>