Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 10th, 2013, 06:45 AM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Insert & in last author references

Hi Gurus,

Inserting the text in between authors, (last author & sign before) remaining authors should be a comma separation.

XML Coding as follows.

HTML Code:
<person-group person-group-type="author">
<name>
<surname>Beyer</surname>
<given-names>K.</given-names>
</name>
<name>
<surname>Bardina</surname>
<given-names>L.</given-names>
</name>
<name>
<surname>Grishina</surname>
<given-names>G.</given-names>
</name>
I tried the XSL Code as follows.

HTML Code:
<xsl:template match="//ref/nlm-citation/person-group/name">
<xsl:next-match/>
 <xsl:for-each select=".">
    <xsl:choose>
	      <xsl:when test="position()=last()">
		      <xsl:text>&lt;xPunc&gt;ampersand &lt;/xPunc&gt;</xsl:text>
	      </xsl:when>
	      <xsl:otherwise>
		      <xsl:text>&lt;xPunc&gt;, &lt;/xPunc&gt;</xsl:text>
	      </xsl:otherwise>
    </xsl:choose>
 </xsl:for-each>
</xsl:template>
The above code inserting the ampersand in all the author name tag after.
&lt;xPunc&gt;ampersand &lt;/xPunc&gt;. I need only for the last author before the ampersand, remaining authors between comma only to insert.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select records & insert to a table lryckman Access VBA 0 November 3rd, 2010 04:13 PM
Insert Record & retrieve ID gundulf ADO.NET 5 July 12th, 2007 10:03 PM
Insert into & order by... kiwikencox SQL Server 2000 5 October 13th, 2005 05:06 AM
replace fillin with ask fields & add references mariatherp Beginning VB 6 1 December 15th, 2004 06:12 AM
INSERT & SELECT FROM....? No idea Seb_soum Classic ASP Databases 3 May 14th, 2004 07:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.