Altova Mailing List Archives


RE: [xsl] Cannot write an attribute node when no element start tag is open [was mistitled]

From: "Michael Kay" <mhk@--------->
To:
Date: 5/14/2004 4:36:00 PM
You get this error message from Saxon if you write

<e>
   some text
   <xsl:attribute name="a">3</xsl:attribute>
</e>

In your case the attribute is written from within a called template but the
effect is the same.

You can't add an attribute to an element after adding children to the
element.

Probably your previous XSLT processor was ignoring the error. It's one of
those recoverable errors that a processor is not obliged to report. The
fallback action is to ignore the attribute node.

Michael Kay 

> -----Original Message-----
> From: Shiva.Sadayan@xxxxxxxxxxxxxxxxxxxxxxxx 
> [mailto:Shiva.Sadayan@xxxxxxxxxxxxxxxxxxxxxxxx] 
> Sent: 14 May 2004 12:53
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] dynamically generated XSL that needs to 
> include namespace for extension functions
> 
> Hi,
> Can someone tell what error is this?
> 
> 	*** Cannot write an attribute node when no element 
> start tag is open
> ***
> 
> 
> *****Background story******
> This Code was working all right in Apache, recently we started to use
> RenderX.  
> 
> 
> <xsl:template name="questhead">
> 	<xsl:param name="MailName"/>
> 	<xsl:param name="BirthDate"/>
> 	<xsl:param name="ReferenceCode"/>
> 	<xsl:param name="BorderStyle"/>
> 
> 	<xsl:attribute name="border-before-style"><xsl:value-of
> select="$BorderStyle"/></xsl:attribute>
> 	<xsl:attribute name="border-start-style"><xsl:value-of
> select="$BorderStyle"/></xsl:attribute>
> 	<xsl:attribute name="border-end-style"><xsl:value-of
> select="$BorderStyle"/></xsl:attribute>
> 
> 
> Cheers
> 
> Shiva S.
> 
> -----Original Message-----
> From: Michael Kay [mailto:mhk@xxxxxxxxx]
> Sent: 14 May 2004 13:43
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] dynamically generated XSL that needs to include
> namespace for extension functions
> 
> 
> > 
> > I am using a stylesheet to generate XSL within an 
> > xsl:document command.
> 
> Not sure what you mean by the xsl:document "command" - do you 
> mean the XSLT
> 1.1 instruction of that name?
> > 
> > The problem I have is that I want to include the xmlns:str 
> > namespace to my
> > generated stylesheet so that I can use the EXSLT string function
> > uri-decode().
> 
> XSLT 2.0 has an xsl:namespace instruction for this purpose. 
> In 1.0 there is
> a workaround: copy the namespace from a source document. E.g.
> 
> <xsl:variable name="dummy">
>   <str:dummy xmlns:str="the namespace"/>
> </xsl:variable>
> 
> <xsl:copy-of select="xx:node-set($dummy)//namespace::str"/>
> 
> Michael Kay
> 
> (XQuery, incidentally, decided not to provide this 
> capability. I think I
> will start pointing out all the things you can do with XSLT 
> 2.0 and not with
> XQuery 1.0, just in case anyone believes that Microsoft have got it
> right...)
> 
> 
> 
> ______________________________________________________________
> 
> CONFIDENTIALITY NOTICE
> 
> This communication and the information it contains is 
> intended for the person or organisation to 
> whom it is addressed.  Its contents are confidential and may 
> be protected in law.  Unauthorised use,
>  copying or disclosure of any of it may be unlawful.  If you 
> are not the intended recipient, please 
> contact us immediately.
> 
> The contents of any attachments in this e-mail may contain 
> software viruses, which could damage your 
> own computer system.  While Marlborough Stirling has taken 
> every reasonable precaution to minimise 
> this risk, we cannot accept liability for any damage, which 
> you sustain as a result of software 
> viruses.  You should carry out your own virus checking 
> procedure before opening any attachment.
> 
> 
> Marlborough Stirling plc, Registered in England and Wales 
> Registered No. 3008820,
> Allen Jones House, Jessop Avenue, Cheltenham, 
> Gloucestershire, GL50 3SH
> Tel: 01242 547000     Fax: 01242 547100
> http://www.marlborough-stirling.com

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.