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

RE: What is causing this XSLT NAMESPACE_ERR?

  • From: "Michael Kay" <mike@s...>
  • To: "'Michael Good'" <musicxml@g...>,<xml-dev@l...>
  • Date: Fri, 8 Jun 2007 09:46:49 +0100

RE:  What is causing this XSLT NAMESPACE_ERR?
My guess would be that this error occurs while writing a DOM to hold the
output. Are you writing to a DOM? (If so, why?) Does the error go away if
you serialize the result instead?

At any rate, it looks to me like a problem that's specific to the (Xalan?)
product. Try it on Saxon.

Incidentally, your predicate 

match="credit[@page and (@page != '1')]"/>

can be rewritten

match="credit[@page != '1']"/>

since the predicate will be false if there is no @page attribute.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Michael Good [mailto:musicxml@g...] 
> Sent: 08 June 2007 00:51
> To: xml-dev@l...
> Subject:  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
> 
> ______________________________________________________________
> _________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by 
> OASIS to support XML implementation and development. To 
> minimize spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l... List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 



[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-2011 All Rights Reserved.