Subject: [xsl] processing-instruction() From: "Jiang, Peiyun" <Peiyun.Jiang@xxxxxx> Date: Wed, 31 Jul 2002 10:05:25 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Breaking large table up i, Shawn . Lindstrom | Thread | Re: [xsl] processing-instruction(), Joerg Heinicke |
Re: [xsl] Breaking large table up i, David Carlisle | Date | Re: [xsl] Multi Level Grouping usin, Jeni Tennison |
Month |