Page 1 of 1

<xsl:output> and 'name' attribute

Posted: Thu Jun 23, 2005 8:46 pm
by coupes
Hi,

This isn't much of an issue as it doesn't really cause any problem for me at the moment. Anyhow, whenever I tried to parse my xml files, Oxygen came up with an error saying I did not define the 'name' attribute of the 'output' element. Maybe I'm mistaking, but I though there was no such thing as a name attribute in the output element. However, as soon as I put a name attribue, the error was gone and the file parsed correctly.

What's the deal with that ?

Posted: Fri Jun 24, 2005 11:56 am
by sorin_ristache
Hello,

If you are editing a XSLT stylesheet the <xsl:output> element where xsl is a prefix for the XSLT namespace http://www.w3.org/1999/XSL/Transform does not have an attribute name. If you are editing other type of XML document probably the schema of that document specifies that the name attribute is required. Please post small samples of the document and schema used to validate that document so we can get the same error.

Best regards,
Sorin

Posted: Tue Jun 28, 2005 4:13 pm
by coupes
Hi, thanks for your reply.

I'm simply editing an xslt stylesheet (with the xsl namespace), but I'm using <result-document> to generate multiple html pages.

Re: <xsl:output> and 'name' attribute

Posted: Tue Jun 28, 2005 4:58 pm
by sorin_ristache
Hello,
coupes wrote:whenever I tried to parse my xml files, Oxygen came up with an error saying I did not define the 'name' attribute of the 'output' element.
What do you mean by parsing an XML file ? When you are editing an XSLT 2.0 stylesheet the xsl:output element is not necessary to have a name attribute. The following simple stylesheet is valid and applied on any XML document generates a file C:\temp\output.html that can be viewed in any Web browser no matter where is located the XML input document and the XSLT 2.0 stylesheet:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output encoding="UTF-8"/>

<xsl:template match="/">
<xsl:result-document href="file:/C:/temp/output.html">
<html>
<head>
<title>Simple HTML document</title>
</head>
<body>
<p>The <b>xsl:output</b> element has no <b>name</b> attribute.</p>
</body>
</html>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>
Best regards,
Sorin

Posted: Tue Jun 28, 2005 5:32 pm
by coupes
I found out what the problem was... :oops:

I had a format attribute specified for some of my <xsl:result-document> elements. So I had to have the name attribute.

This also helped me solve another problem I had, where my html output was indented despite the indent="no" I had specified in my <xsl:output>. Turns out I hadn't specified a format attribute for this particular <xsl:result-document> element.

Thanks again sorin.