xsl-list
[Top] [All Lists]

Re: [xsl] how to output a processing instruction

2010-05-19 06:32:49
Nnaemeka David wrote:

i was reading the xslt 1.0 recommendation but could not output the example 
processing instruction to an html file.
<xsl:processing instruction name="xml-stylesheet">href="me.css" 
type="text/css"</xsl:processing-instruction>
i tried several ways, first of all through the head element and lastly, replacing the text 
nodes with two <xsl:attribute > tags with the href and type being attribute value 
templates. i still couldn't. can someone help me out and show me how to insert a 
<?xml-stylesheet...?> into the html output?


<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns="http://www.w3.org/1999/xhtml";
  version="1.0">

<xsl:template match="/">
<xsl:processing-instruction name="xml-stylesheet">href="me.css" type="text/css"</xsl:processing-instruction>
  <html>
    ...
  </html>
</xsl:template>


should do, assuming you want to create an XHTML result document to be parsed as XML by an user agent.

If you want to create text/html output then I would not use xsl:processing-instruction to link to a stylesheet, instead I would put an HTML "link rel=stylesheet" element in the head section of the HTML document.

--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>