Home / General / Adding a Style-sheet Declaration to your XML Output
digWin is a community news sharing site for Microsoft Techies. Share interesting news/links and rate them!

Adding a Style-sheet Declaration to your XML Output

A common requirement for formatting XML output from XQuery expressions, is to be able to add a style-sheet declaration. Style-sheet declarations consist of a standard processing-instruction node that appears at the top-level of the XML. In the following example, we are attempting to construct a PI node, then select a peice of XML that will make up the body of the result:

declare @x xml
set @x='<myXML/>'

select @x.query('
<?xml-stylesheet type="text/xsl" href="my-style-sheet.xsl" ?>
/.
')

But, when you try and execute this query, you receive the following error













Microsoft news, tips and tricks search

Comments


Post voted by 1 digWinners


Featured Links

User

Login | Register




Forgot Password?

Sponsor

Anti spam filter for mail servers
Anti spam, anti phishing and email management software for Exchange/SMTP/Lotus. Download a FREE trial!

Featured Product

Download Free Exchange Ebook

Categories

Upcoming NEW

Recent comments

Related Sites