productioncoder
productioncoder

Reputation: 4335

XSLT Illegal attribute 'separator'

Aloha,

while writing an XSLT stylesheet, I encountered a problem, I could not solve. My basic XML structure is the following

<nonUniqueConstraint name = "...">
  <column name = "..."/>
  <column name = "..."/>
</nonUniqueConstraint>

I want to print the names of all columns. Therefore I used the following statement (I'm iterating over all nonUniqueConstraints):

    <xsl:value-of select="./column/@name" separator=", "/>

However when I run my Ant build file, it outputs the following:

Error! [ERR 0510][ERR XTSE0090] The illegal atttribute 'separator' is specified

I looked for the error and found the following description:

[ERR XTSE0090] It is a static error for an element from the XSLT namespace to have an attribute whose namespace is either null (that is, an attribute with an unprefixed name) or the XSLT namespace, other than attributes defined for the element in this document.

Nevertheless I have seen many examples using the separator attribute, e.g. here.

How can I fix that problem?

Cheers

Upvotes: 3

Views: 1419

Answers (2)

Michael Kay
Michael Kay

Reputation: 163625

I think you should check which XSLT processor you are running.

The error is a little odd, because the error code XTSE0090 is defined only in XSLT 2.0, yet XSLT 2.0 permits the separator attribute. Jirka's reply is only partially correct. If you are running an XSLT 1.0 processor, it will always reject the separator attribute, but it is unlikely to use the XSLT 2.0 error code XTSE0090. If you are running a 2.0 processor, it should accept the separator attribute whether the stylesheet specifies version="1.0" or version="2.0". So there's something a bit strange going on.

To check what XSLT processor you are using, use the XSLT system-property() function to write a message.

Upvotes: 3

Jirka Š.
Jirka Š.

Reputation: 3428

Look at stylesheet element on version attribute - it should be 2.0 to enable attribute "separator" at xsl:value-of

<xsl:stylesheet version="2.0"...

Upvotes: 4

Related Questions