carlruiz07 Posted May 26, 2007 Share Posted May 26, 2007 Hi. I am new student of XSLT. After checking the entire XSLT forum, I still haven’t solved my problem. I create a XSLT document from StyleVision and make some work directly in the code using Altova XML spy. This last software gives the chance to make a XSL transformation fast and transparent for me. Right know I would like to do this transformation by myself, loading a XML document in my XSLT document and show it in a internet browser (internet explorer and Firefox).In my XSL document (called plantilla.xsl) I have this <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xDt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:output version="1.0" method="html" indent="no" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd"/> <xsl:param name="SV_OutputFormat" select="'HTML'"/> <xsl:variable name="XML" select="document('1212.xml')"/> <xsl:template match="/"> <html>......</html> </xsl:template></xsl:stylesheet> Where 1212.xml is the document I would like to transform. Then I save this XSL document with different extensions. When I save in .html and open it in fire fox, show the template but not the information from the xml document and when I open it in the browser as simple XSL document displays it as plain text.What can I do for do it right??.I appreciate your collaboration because I am so stuck. Thanks.Carlos Ruiz Link to comment Share on other sites More sharing options...
boen_robot Posted May 26, 2007 Share Posted May 26, 2007 Instead of sorting the document in a variable, sort a reference to it in a variable. When you need to access the document, use document($XML) at that spot.So, your variable will be: <xsl:variable name="XML" select="'1212.xml'"/> And if you wanted to value-of a value in it, you'll do: <xsl:value-of select="document($XML)/path/to/the/value/that/you/want"/> Link to comment Share on other sites More sharing options...
carlruiz07 Posted May 26, 2007 Author Share Posted May 26, 2007 Instead of sorting the document in a variable, sort a reference to it in a variable. When you need to access the document, use document($XML) at that spot.So, your variable will be:<xsl:variable name="XML" select="'1212.xml'"/> And if you wanted to value-of a value in it, you'll do: <xsl:value-of select="document($XML)/path/to/the/value/that/you/want"/> I will try. In which format should I open this xslt document. As html or xsl. Thanks Again.Carlos Ruiz Link to comment Share on other sites More sharing options...
boen_robot Posted May 26, 2007 Share Posted May 26, 2007 What? Isn't 1212.xml an XML document? If it's not, then it must be, as document() can only fetch contents from XML files.Well.... unparsed-text() allows the fetching of any text document, including XML documents, but you'll have to fetch whatever you want with regular expressions. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.