XLST: is there a formal definition?

  • Thread starter Pascal Sartoretti
  • Start date
P

Pascal Sartoretti

Hello,

I am looking for a formal definition of XSLT. Either a DTD or an XML
Schema, whatever. Is there such a thing ? There is for instance one for
XML Schema itself at http://www.w3.org/2001/XMLSchema.dtd .

My problem is that I have a big set of XSLT files which may contain
errors: for instance, use of XLST features that were only in the draft
XSLT norm, but which Microsoft IE still supports. A DTD or XML Schema
would greatly help me in checking the XSLT files.

Thanks for any help

Pascal
 
M

Martin Honnen

Pascal said:
I am looking for a formal definition of XSLT. Either a DTD or an XML
Schema, whatever. Is there such a thing ? There is for instance one for
XML Schema itself at http://www.w3.org/2001/XMLSchema.dtd .

My problem is that I have a big set of XSLT files which may contain
errors: for instance, use of XLST features that were only in the draft
XSLT norm, but which Microsoft IE still supports. A DTD or XML Schema
would greatly help me in checking the XSLT files.

A DTD can't exist as an XSL stylesheet contains arbritray result
elements, there is however a DTD fragment
http://www.w3.org/TR/xslt#dtd
 
P

Pascal Sartoretti

Martin said:
A DTD can't exist as an XSL stylesheet contains arbritray result
elements

Oops, you are right... However, would it be possible to define an XSLT
transform that would scrap out all non-XSLT tags and then return a
"pure" XSLT document, which could be checked against a DTD or XML schema?

Pascal
 
M

Martin Honnen

Pascal said:
Oops, you are right... However, would it be possible to define an XSLT
transform that would scrap out all non-XSLT tags and then return a
"pure" XSLT document, which could be checked against a DTD or XML schema?

I think such an XSLT stylesheet could be written.
As for an XML schema, that even allows you to define an element to have
children in a different, abritrary namespace that are skipped during
validation, an example for that is at
http://www.webmethods.com/1999/XSL/Transform/
I have just found it through googling so I can't tell you how well it is
written but at least the comments at the beginning indeed suggest that
validation is skipped for abritrary result elements.
 
P

Patrick TJ McPhee

% > A DTD can't exist as an XSL stylesheet contains arbritray result
% > elements
%
% Oops, you are right... However, would it be possible to define an XSLT
% transform that would scrap out all non-XSLT tags and then return a
% "pure" XSLT document, which could be checked against a DTD or XML schema?

You could just copy all the elements in the xslt name space:

<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:template match='xsl:*|@*'>
<xsl:copy>
<xsl:apply-templates select='node()|@*'/>
</xsl:copy>
</xsl:template>

<xsl:template match='*'>
<xsl:apply-templates match='node()|@*'/>
</xsl:template>
</xsl:stylesheet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top