Understanding XML style sheet processing instructions

Processing instructions are added to the result of the transformation by using the xsl:processing-instruction element. If you want to include a stylesheet file like compact.css to your html file output, then you would look for a statement like,


_______________________________________________

<?xml-stylesheet href="compact.css" type="text/css">

in the output. This type of output can be given by using the xsl:processing-instruction element in the xsl file you are creating for your xml file. With this method you can also create alternate stylesheets for your web pages.

<xsl:processing-instruction name="xml-stylesheet">
<xsl:text>href="compact.css" type="text/css"</xsl:text>
</xsl:processing-instruction>

The above code is a processing instruction that will give you the result in which you will have the "xml-stylesheet" tag. In the output you can note that the processing instruction outputted ends with '>' and not '?>'. This is because the output was set to be html. If the output of the transformation is some other format then the processing instruction in the result would end with '?>'.




_______________________________________________

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________








 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!

Visit XML Training Material Guide Homepage

 

 

Copyright - © 2004 - 2017 - All Rights Reserved.