i am trying to create a transformation which output will be text but including original xml as well. Simply i got the xml message that should be transformed to SQL insert but in case of an SQL error i want to insert the original xml message to database as well.
The input is e.g.:
<message><tag name="foo">dummy</tag></message>
The result of the transformation should be then:
INSERT INTO table (column) VALUES ('dummy')
IF @@error <> 0
BEGIN
INSERT INTO errMsgLog (message) VALUES ('<message><tag name="foo">dummy</tag></message>')
END
The problem is if i set the output in XSLT to ‘text’ there are no xml tags included (just the values). So is there any mixed output mode or attribute override?
Thanks for any help.
Before approaching this solution (don’t know if through XSLT you can find some better solution), also consider the problems you will encounter with much more complex input and output.
Even if purists will reject this answer (and the question also), you can use “xml” output method to do a (very ugly) trickery:
outputs: