hectorsales Posted April 24, 2013 Posted April 24, 2013 I have the file horario.xml and I want convert horario.xml in different xml through an xslt stylesheet.I'm going to file it horario.xml I link to the stylesheet .. using ..<? xml-stylesheet href = "exercise1.xsl" type = "text / xsl">In exercise1.xsl I have as an output:<xsl:output method="xml" />And from there I do not know which is exactly what you need to do .... Greetings....
Martin Honnen Posted April 25, 2013 Posted April 25, 2013 Well the xml-stylesheet processing instruction is mainly used by browsers to automatically transform an XML document loaded in a browser window with the referenced stylesheet. On the other hand most browser like Mozilla or IE expect you to transform XML to some format they know to render, e.g. XML to XHTML or to XHTML plus SVG. So if you want to transform XML to XML then trying this inside of the browser is not necessary a good environment to test such transformation. As for how to do XML to XML transformation, assuming you have the input <root> <list> <item>foo</item> <item>bar</item> </list></root> and you want to transform that to XHTML then you simply write templates performing the transformation e.g. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output indent="yes"/> <xsl:template match="/"> <html xml:lang="en"> <head> <title>Example</title> </head> <body> <h1>Example</h1> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="list"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="item"> <li> <xsl:apply-templates/> </li> </xsl:template> </xsl:stylesheet> See it online at http://home.arcor.de/martin.honnen/xslt/test2013042501.xml. So whether you want to transform XML to HTML or to XML does not make much of the difference as to how you write stylesheets, you simply write templates matching the nodes in the input XML and you create result elements of the output XML or HTML.
hectorsales Posted April 25, 2013 Author Posted April 25, 2013 Thanks for the clarification .. Greetings..........
Recommended Posts
Archived
This topic is now archived and is closed to further replies.