[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: processing-instruction()

Subject: RE: processing-instruction()
From: "Jiang, Peiyun" <Peiyun.Jiang@xxxxxx>
Date: Wed, 31 Jul 2002 10:32:47 -0400
processing instruction pub
Thanks, Joerg. I still have the PIs in the output with the following
Stylesheet. I do have the
specific matchings for the PIs. I'm using xalan. Are PIs in node()? My
impression from a book is that node() only matches elements. 

Thanks.

Peiyun

  <xsl:template match="/">     
     <equations>
        <xsl:for-each select="//equation|//inlineequation" >
          <xsl:copy>
             <xsl:copy-of select="@*" />
             <xsl:apply-templates select="node()" />
          </xsl:copy>
        </xsl:for-each>
     </equations>       
  </xsl:template>
  
  <xsl:template match="node()">
       <xsl:copy>
            <xsl:copy-of select="@*" />
            <xsl:apply-templates select="node()" />
       </xsl:copy>
  </xsl:template>
  
  <xsl:template match="processing-instruction('Eqn')">
      <!-- do nothing now -->
  </xsl:template>
  
  <xsl:template match="processing-instruction('Pub')">
      <!-- do nothing now, but want to keep -->
  </xsl:template>
  

-----Original Message-----
From: Joerg Heinicke [mailto:joerg.heinicke@xxxxxx]
Sent: Wednesday, July 31, 2002 10:17 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  processing-instruction()


processing-instruction() is included in node(), so if you do

<xsl:apply-templates select="node()" />

and if you have a template matching on node(), you don't need the special 
<xsl:apply-templates/> and <xsl:template/> for the processing instructions. 
If you remove every pi-stuff they will be simply copied to output. If you 
add a template matching on the special processing-instruction, this one will

not be copied to output.

Regards,

Joerg

Jiang, Peiyun wrote:
> What's wrong?
> 
> I'm trying to match processing instructions. I want to get rid of the
<?Eqn
> TeX input="\hskip -32pt\hbox to32pt{[6]}"?> part in the source file. 
> 
> Source file: <equation> and <inlineequation> mixed with text and markup.
> XSLT: I match every <equation> and <inlineequation> and copy recursively
any
> attributes and elements. I match processing instructions and remove them
all
> (but I want to keep some of them later).
> output: no processing instructions removed.
> 
> Am I doing the right thing to match the processing instructions? See
> stylesheet below.
> 
> Thanks.
> 
> Peiyun
> 
> 
> -----------------------
> source: equations mixed with text.
> <doc>Text before equations.
> <inlineequation id="il1"><?Pub Eqn?>
> <f><rm><a><ac>CV</ac><ac>&d4;</ac></a><fen lp="par"><rm><g>q</g></rm>
> <rp post="par"/></fen></rm></f>
> </inlineequation>
> More text and other <tags></tags> more text.
> <equation id="eqn006"><?Pub Eqn?>
> <fd><fl><rm><?Eqn TeX input="\hskip -32pt\hbox to32pt{[6]}"?></rm>
> <rm>Prob<fen lp="par"><mit>m<inf>ij</inf>&vbm0;R<inf>j</inf><rm>,</rm>
> <g>p</g><inf>ij</inf></mit><rp post="par"/></fen>=<fen lp="par"><stk>
>
<lyr><mit>Rj</mit></lyr><lyr><it><mit>m<inf>ij</inf></mit></it></lyr></stk>
> <rp post="par"/></fen><g>p</g><sup><mit>m<inf>ij</inf></mit></sup><inf>
> <mit>ij</mit></inf></rm><fen lp="par">1-<g>p</g><inf>ij</inf><rp
> post="par"/></fen>
> <sup>R<inf>j</inf>-m<inf>ij</inf></sup></fl></fd>
> </equation>
> <moretext></moretext> more text.
> </doc>
> -----------------------
> output: equations without text.
> 
> <equations>
> <inlineequation id="il1"><?Pub Eqn?>
> <f><rm><a><ac>CV</ac><ac>&d4;</ac></a><fen lp="par"><rm><g>q</g></rm>
> <rp post="par"/></fen></rm></f>
> </inlineequation>
> <equation id="eqn006"><?Pub Eqn?>
> <fd><fl><rm><?Eqn TeX input="\hskip -32pt\hbox to32pt{[6]}"?></rm>
> <rm>Prob<fen lp="par"><mit>m<inf>ij</inf>&vbm0;R<inf>j</inf><rm>,</rm>
> <g>p</g><inf>ij</inf></mit><rp post="par"/></fen>=<fen lp="par"><stk>
>
<lyr><mit>Rj</mit></lyr><lyr><it><mit>m<inf>ij</inf></mit></it></lyr></stk>
> <rp post="par"/></fen><g>p</g><sup><mit>m<inf>ij</inf></mit></sup><inf>
> <mit>ij</mit></inf></rm><fen lp="par">1-<g>p</g><inf>ij</inf><rp
> post="par"/></fen>
> <sup>R<inf>j</inf>-m<inf>ij</inf></sup></fl></fd>
> </equation>
> </equations>
> -----------------------
> stylesheet:
>   <xsl:template match="/">     
>      <equations>
>         <xsl:for-each select="//equation|//inlineequation" >
>           <xsl:copy>
>              <xsl:copy-of select="@*" />
>              <xsl:apply-templates select="node()" />
>              <xsl:apply-templates select="processing-instruction('Eqn')"
/>
>              <xsl:apply-templates select="processing-instruction('Pub')"
/>
>           </xsl:copy>
>         </xsl:for-each>
>      </equations>       
>   </xsl:template>
>   
>   <xsl:template match="node()">
>        <xsl:copy>
>             <xsl:copy-of select="@*" />
>             <xsl:apply-templates select="node()" />
>              <xsl:apply-templates select="processing-instruction('Eqn')"
/>
>              <xsl:apply-templates select="processing-instruction('Pub')"
/>
>        </xsl:copy>
>   </xsl:template>
>   
>   <xsl:template match="processing-instruction('Eqn')">
>       <!-- do nothing now -->
>   </xsl:template>
>   
>   <xsl:template match="processing-instruction('Pub')">
>       <!-- do nothing now, but want to keep -->
>   </xsl:template>
>  
> -----------------------
> desired output: (inline)equations only and without <?Eqn ...?> 
> <equations>
> <inlineequation id="il1"><?Pub Eqn?>
> <f><rm><a><ac>CV</ac><ac>&d4;</ac></a><fen lp="par"><rm><g>q</g></rm>
> <rp post="par"/></fen></rm></f>
> </inlineequation>
> <equation id="eqn006"><?Pub Eqn?>
> <fd><fl><rm></rm>
> <rm>Prob<fen lp="par"><mit>m<inf>ij</inf>&vbm0;R<inf>j</inf><rm>,</rm>
> <g>p</g><inf>ij</inf></mit><rp post="par"/></fen>=<fen lp="par"><stk>
>
<lyr><mit>Rj</mit></lyr><lyr><it><mit>m<inf>ij</inf></mit></it></lyr></stk>
> <rp post="par"/></fen><g>p</g><sup><mit>m<inf>ij</inf></mit></sup><inf>
> <mit>ij</mit></inf></rm><fen lp="par">1-<g>p</g><inf>ij</inf><rp
> post="par"/></fen>
> <sup>R<inf>j</inf>-m<inf>ij</inf></sup></fl></fd>
> </equation>
> </equations>
> -----------------------
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


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

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.