Subject: Re: [xsl] Tagging of text() with using apply templates From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> Date: Mon, 25 Oct 2010 14:32:23 +0530 |
I would suggest a stylesheet something like below: (this is of 2.0 flavor, incomplete -- but i believes gives a fair idea of the algorithm i have in mind, and untested) <!-- identity template --> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="ref"> <bibentry type="{concat('bib', label)}" publication="{if (mixed-citation/@publication-type) = 'journal' then 'jurnl' else ()}"> <xsl:apply-templates/> </bibentry> </xsl:template> <xsl:template match="label"> <num> <xsl:value-of select="." /> </num> </xsl:template> <xsl:template match="mixed-citation"> <authorgrp> <xsl:for-each select="name"> <author> <xsl:copy-of select="surname" /> <fname> <xsl:value-of select="given-names" /> </fname> </author> </xsl:for-each> </authorgrp> <article type="title"> <xsl:value-of select="article-title" /> </article> <article type="jurnl"> <xsl:value-of select="source" /> </article> <!-- to write something more here. --> </xsl:template> <xsl:template match="text()[not(normalize-space(.) = '-')][preceding-sibling::node()[1]/self::*]"> <x><xsl:value-of select="normalize-space(.)" /></x> </xsl:template> On Mon, Oct 25, 2010 at 1:45 AM, chirag matkar <chiragmatkarbioinfo@xxxxxxxxx> wrote: > Input is > B B B B <ref id="B5"> > B B B B <label>5</label> > B <mixed-citation publication-type="journal"> > B B B B B B <name> > B B B B B B B <surname>Kaplan</surname>, > B B B B B B B <given-names>SH</given-names> > B B B B B B </name>; > B B B B B B <name> > B B B B B B B <surname>Greenfield</surname>, > B B B B B B B <given-names>S</given-names> > B B B B B B </name>; > B B B B B B <name> > B B B B B B B <surname>Ware</surname>, > B B B B B B B <given-names>JE</given-names> > B B B B B B </name>. > B B B B B <article-title>Assessing the effects of physician-patient > interactions on the outcome of chronic disease</article-title>, > B B B B B <source>Med Care</source>, > B B B B B <year>1989</year>, > B B B B B <volume>27</volume>, > B B B B B <supplement>suppl 3</supplement>, > B B B B B <fpage>110</fpage>- > B B B B B <lpage>125</lpage> > B B B B </mixed-citation> > B B B </ref> > > > Required output > > <bibentry type="bib5" publication="jurnl"> > B B B B <num>5</num> > <authorgrp> > B B B B B B <author> > B B B B B B B <surname>Kaplan</surname><x>,</x> > B B B B B B B <fname>SH</fname> > B B B B B B </author><x>;</x> > B B B B B <author> > B B B B B B B <surname>Greenfield</surname><x>,</x> > B B B B B B B <fname>S</fname> > B B B B B B </author><x>,</x> > B B B B B B <author> > B B B B B B B <surname>Ware</surname><x>,</x> > B B B B B B B <fname>JE</fname> > B B B B B B </author><x>.</x> > </authorgrp> > B B B B B <article type="title">Assessing the effects of > physician-patient interactions on the outcome of chronic > disease</article-title>, > B B B B B <article type="jurnl">Med Care</article><x>,</x> > B B B B <date year="1989"> 1989</date><x>,</x> > B B B B B <volnum>27</volnum><x>,</x> > B <pagefield> > B B B B B <fpage>110</fpage>- > B B B B B <lpage>125</lpage> > </pagefield> > B B B </bibentry> > > > In output Mainly except - ,everthing else like . , ; should come under <x> tag > Also the input of , , ; can be random > > I have use apply templates sequentially for authorgrp and others but > the random input of . , ; is not B tagged inside <x> > > > -- > Regards, > Chirag Matkar -- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Tagging of text() with using , chirag matkar | Thread | Re: [xsl] Tagging of text() with us, chirag matkar |
[xsl] Tagging of text() with using , chirag matkar | Date | [xsl] Ordering in XSL:Apply-Templat, Ramkumar.V |
Month |