This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PIs with XT


At 00/03/21 17:06 +0100, Beckers, Marc wrote:
>My XSL stylesheet for HTML then has:
>
><!-- processing instruction for new line -->
>   <xsl:template name="processing-instruction(newline)">
>     <br/>
>   </xsl:template>
>
>The output HTML shows nothing.
>I get the same result with <xsl:template name="processing-instruction()">.

Two things:

(1) - you are using name= instead of match=

(2) - when supplying a PITarget literally, it must be a literal.

>Can anyone shed light?

I hope the example below helps.

............... Ken

T:\ftemp>type pi.xml
<?xml version="1.0"?>
<test>
This is a test<?newline?>of text
</test>
T:\ftemp>type pi.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">

<xsl:template match="/">                         <!--root rule-->
  <result>
   <test1>
    <xsl:apply-templates mode="test1"/>
   </test1>
   <test2>
    <xsl:apply-templates mode="test2"/>
   </test2>
  </result>
</xsl:template>

<xsl:template match="processing-instruction('newline')"
               mode="test1">
   <br/>
</xsl:template>

<xsl:template match="processing-instruction()"
               mode="test2">
   <br/>
</xsl:template>

</xsl:stylesheet>

T:\ftemp>xt pi.xml pi.xsl
<?xml version="1.0" encoding="utf-8"?>
<result><test1>
This is a test<br/>of text
</test1><test2>
This is a test<br/>of text
</test2></result>
T:\ftemp>

--
G. Ken Holman                    mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-04-7
Next instructor-led training:    2000-05-02,2000-05-11/12,2000-05-15,
-                                    2000-06-12,2000-06-13,2001-01-27


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]