[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

What is causing this XSLT NAMESPACE_ERR?

  • From: "Michael Good" <musicxml@g...>
  • To: xml-dev@l...
  • Date: Thu, 7 Jun 2007 16:50:59 -0700

What is causing this XSLT NAMESPACE_ERR?
I have a MusicXML 2.0 document that has this fragment:

  <credit page="1">
    <credit-words default-x="1580" default-y="3799"
                         font-size="24" font-weight="bold" justify="center"
                         valign="top" xml:lang="fr">La Bohème
</credit-words>
    <credit-words font-size="16" font-weight="normal">Act I—In
Soffitta</credit-words>
  </credit>

The page attribute for the credit element is new to MusicXML 2.0. In
MusicXML, all credits were on page 1. So our XSLT 1.0 stylesheet that
transforms to MusicXML 1.1 removes the page attribute, along with any
credit elements that are not on page 1:

  <!-- Remove a credit that is not on page 1 -->
 <xsl:template
    match="credit[@page and (@page != '1')]"/>

  <!-- Remove the page attribute for page 1 credits -->
  <xsl:template
    match="credit/@page[. = '1']"/>

All works well until there is an xml:lang attribute in the
credit-words element, as in the above example. When this happens,
Xerces 2.9.0 gives us an error:

XSLT fatal error at line 1: org.w3c.dom.DOMException: NAMESPACE_ERR:
An attempt is made to create or change an object in a way which is
incorrect with regard to namespaces.

If I remove the rule to get rid of the page attribute, the error
message goes away. We don't use any namespace or default namespaces in
MusicXML except for some XLink constructs and the xml:lang attribute.

Our generic identity transformation for elements and attributes is:

  <xsl:template match="*|@*|comment()|processing-instruction()">
    <xsl:copy><xsl:apply-templates
        select="*|@*|comment()|processing-instruction()|text()"
    /></xsl:copy>
  </xsl:template>

Can anybody explain what might be going on here to cause the error?
How would removing a page attribute in a parent element relate to the
xml:lang attribute in the child element? Am I doing something wrong in
one of these rules that is doing something unintended?

Thanks for any assistance!

Best regards,

Michael Good
Recordare LLC
www.recordare.com


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.