I’m totally stuck on what is going on when I try to run the following xml against an xsl in an attempt to not get a blank page in the browser:
xml:
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="transform.xsl"?>
<Structure>
<Processes>
<Process>
.
.
.
</Process>
</Processes>
</Structure>
xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<!--trying to convert the tag to another name -->
<xsl:template match="/">
<xsl:element name="NewStructure">
<xsl:apply-templates select="Processes" />
</xsl:element>
</xsl:templates>
<xsl:template name="convert_processes_tag" match="Processes">
<xsl:for-each select="Processes">
<xsl:element name="NewProcess" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
My goal is to replace the Processes tag with something else, and subsequently all the other tags inside the xml too. My first attempt was to convert the outter most tags first. I have tried cutting down both the xml and the xsl to its skeleton, but all I got was a blank page. I tried googling, but it only further confuses me. I know xsl:template is like a method in OOP, and I wanted to separate it because there will be a lot of looping involved in converting the tags to different names.
Been stuck for hours… any help would be appreciated.
EDIT: I was testing this against IE. Someone has pointed out that XML does not show up when testing in IE. Is that the case?
TIA.
A browser is not the right tool if you want to debug XSLT that transforms XML to XML, unless it is a browser like Firefox or Opera and your target XML format is a format like SVG or MathML or XHTML the browser knows to render.
IE is useful if you transform XML to HTML (xsl:output method=”html”) or maybe plain text (xsl:output method=”text”) but when you use it to transform XML to XML (xsl:output method=”xml”) then don’t expect you to show anything but the text nodes in the result document. And in your case you do not even have any text nodes that contain non white space characters so there is nothing to display.