[xsl] xsl:element will not create an output element, in any context

Subject: [xsl] xsl:element will not create an output element, in any context
From: N David Brown <orieldave@xxxxxxxxxxxxxx>
Date: Thu, 31 May 2007 11:55:51 +0000
Hi guys,

It seems that, no matter what the context of an 'xsl:element' element,
no element is output for me. I have performed tests on different
browsers (ff, ie) on different systems, and still get no output!

An example - this W3C-ripped example produces no 'singer' elements for
me in the output:

http://www.w3schools.com/xsl/xsl_transformation.asp

My own code looks like this:

XML:

   <?xml version="1.0" encoding="ISO-8859-1"?>
   <root>rootname
      <dir>dir1
         <file>file1</file>
         <file>file2</file>
      </dir>
      <dir>dir2
         <file>file3</file>
      </dir>
   </root>

XSL:

   <?xml version="1.0" encoding="ISO-8859-1"?>
   <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

   <xsl:template match="*">
      <xsl:element name="test">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>

</xsl:stylesheet>

(my XSL is, unsurprisingly, much different from this in reality but I'm
using this simple stylesheet as an easy test platform)

--> The output from my own code is nothing, in this case, or if I have a
xsl:value-of selection within the 'test' element, then those values
would be output, but no surrounding <test></test>.

My transformations were being done server-side by some PHP I'd coded,
but I now directly link the XSL stylesheet to the XML file and then load
the XML file in the browser, to facilitate this debugging and ensure the
PHP isn't causing the problem.

I've no idea why this is happening, and have been attempting (and
failing) to fix it for about 3 days now in my spare time. Any
suggestions would be really appreciated!

Cheers.

- Dave

Current Thread