In XSLT 2.0:
<xsl:template match="element-citation">
<xsl:for-each-group select="*" group-adjacent="node-name()">
<xsl:choose>
<xsl:when test="self::name">
<author-grp><xsl:copy-of select="current-group()"/></author-grp>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:template>
Michael Kay
Saxonica
On 19/10/2010 15:10, chirag matkar wrote:
Hello Everybody ,
Here is my Doubt
Input is-
<ref id="B1">
<label>1</label>
<element-citation publication-type="journal">
<name>
<surname>Shah</surname>
<given-names>NC</given-names>
</name>
<article-title>Viewpoint: Consultation time—time for
a change? Still the“perfunctory work of perfunctory
men!”</article-title>
<source>Br J Gen Pract</source>
<year>1999</year>
<volume>49</volume>
<fpage>497</fpage>
</element-citation>
</ref>
<ref id="B2">
<label>2</label>
<element-citation publication-type="journal">
<name>
<surname>Mechanic</surname>
<given-names>D</given-names>
</name>
<article-title>How should hamsters run? Some observations
about sufficient patient time in primary care</article-title>
<source>BMJ</source>
<year>2001</year>
<volume>323</volume>
<fpage>266</fpage>
<lpage>268</lpage>
<pub-id pub-id-type="pmid">11485957</pub-id>
</element-citation>
</ref>
<ref id="B3">
<label>3</label>
<element-citation publication-type="journal">
<name>
<surname>Howie</surname>
<given-names>JGR</given-names>
</name>
<name>
<surname>Porter</surname>
<given-names>AMD</given-names>
</name>
<name>
<surname>Heaney</surname>
<given-names>DJ</given-names>
</name>
<name>
<surname>Hopton</surname>
<given-names>JL</given-names>
</name>
<article-title>Long to short consultation ratio: a proxy
measure of quality of care for general practice</article-title>
<source>Br J Gen Pract</source>
<year>1991</year>
<volume>41</volume>
<fpage>48</fpage>
<lpage>54</lpage>
<pub-id pub-id-type="pmid">2031735</pub-id>
</element-citation>
</ref>
<ref id="B4">
<label>4</label>
<element-citation publication-type="journal">
<name>
<surname>Howie</surname>
<given-names>JGR</given-names>
</name>
<name>
<surname>Heaney</surname>
<given-names>DJ</given-names>
</name>
<name>
<surname>Maxwell</surname>
<given-names>M</given-names>
</name>
<name>
<surname>Walker</surname>
<given-names>JJ</given-names>
</name>
<name>
<surname>Freeman</surname>
<given-names>GK</given-names>
</name>
<name>
<surname>Rai</surname>
<given-names>H</given-names>
</name>
<article-title>Quality at general practice consultations:
cross-sectional survey</article-title>
<source>BMJ</source>
<year>1999</year>
<volume>319</volume>
<fpage>738</fpage>
<lpage>743</lpage>
<pub-id pub-id-type="pmid">10487999</pub-id>
</element-citation>
</ref>
Many references after this too
Desired output is al the name tags inside authorgrp tag
<authorgrp>
<name>
<surname>Mechanic</surname>
<given-names>D</given-names>
</name>
</authorgrp>
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--