apply xsl to merge two xml files in jsp

flamuri

New Member
i create a xsl to merge two xml to one, then using the output to another xsl for a html view.when i using xmlSpy to test it, it works very well.but when i put them under a java web application,somethings is wrong.the xsl is as follows\[code\]<?xml version="1.0" encoding="UTF-8" ?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:strip-space elements="*" /> <xsl:variable name="xsdresult" select="document('xsdResult.xml')" /> <xsl:variable name="schresult" select="document('result.xml')" /> <xsl:template match="/"> <xsl:result-document href="http://stackoverflow.com/questions/10499024/fullresult.xml" method="xml"> <fullresult> <xsl:copy-of select="$schresult/node()" /> <xsl:copy-of select="$xsdresult/node()" /> </fullresult> </xsl:result-document> </xsl:template></xsl:stylesheet>\[/code\]and this file and xml files are all under the same directory.and the output file is the same.a jsp to apply this xslt\[code\] <?xml version="1.0" encoding="UTF-8" ?> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@taglib uri="http://jakarta.apache.org/taglibs/xsl-1.0" prefix="xsl"%> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <%@ page%> <title>test</title> </head> <body> <p> <xsl:apply xml="WEB-INF/classes/result/result.xml" xsl="WEB-INF/classes/result/merge.xsl" /> <xsl:apply xml="WEB-INF/classes/result/xsdResult.xml" xsl="WEB-INF/classes/result/merge.xsl" /> <xsl:apply xml="WEB-INF/classes/result/fullresult.xml" xsl="WEB-INF/classes/result/anotherone.xsl" /> </p> </body> </html>\[/code\]the problem is in the merge.xsl, document('xsdResult.xml') and document('result.xml') , they are always searching under eclipse_home directory, not the tomcat webapps direcotry.
 
Back
Top