469,332 Members | 6,821 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

how to locate where an xslt stylesheet failed

Dear experts,

After converting some .net code from using XslTransform to
XslCompiledTransform, one of my XSLs no longer runs. it fails with:

Attribute and namespace nodes cannot be added to the parent element after a
text, comment, pi, or sub-element node has already been added.

trouble is my stylesheet is long and complicated and I don't know where the
error was. is there any way of finding out which line number in the XSLT
produced the error? I tried it on Xml spy (which does tell you where the
error was) but the same transform doesn't fail in xml spy.

Andy
May 23 '07 #1
2 4322
Andy Fish wrote:
After converting some .net code from using XslTransform to
XslCompiledTransform, one of my XSLs no longer runs. it fails with:

Attribute and namespace nodes cannot be added to the parent element after a
text, comment, pi, or sub-element node has already been added.

trouble is my stylesheet is long and complicated and I don't know where the
error was. is there any way of finding out which line number in the XSLT
produced the error?
XsltException
<http://msdn2.microsoft.com/en-us/library/system.xml.xsl.xsltexception.aspx>
has properties LineNumber and LinePosition so assuming you get such an
exception your code should be able to catch it and output those properties.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 23 '07 #2
On 23 May, 17:45, Martin Honnen <mahotr...@yahoo.dewrote:
Andy Fish wrote:
After converting some .net code from using XslTransform to
XslCompiledTransform, one of my XSLs no longer runs. it fails with:
Attribute and namespace nodes cannot be added to the parent element after a
text, comment, pi, or sub-element node has already been added.
trouble is my stylesheet is long and complicated and I don't know where the
error was. is there any way of finding out which line number in the XSLT
produced the error?

XsltException
<http://msdn2.microsoft.com/en-us/library/system.xml.xsl.xsltexception...>
has properties LineNumber and LinePosition so assuming you get such an
exception your code should be able to catch it and output those properties.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Thanks Martin,

I caught the exception but unfortunately these 2 values are both 0 (I
suspect if they weren't they would have appeared in the message).
Still, at least the error message itself is good so it will give me
somewhere to start
May 24 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Pete | last post: by
reply views Thread by JEDI_BC | last post: by
4 posts views Thread by Moogy | last post: by
7 posts views Thread by One Handed Man \( OHM - Terry Burns \) | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.