Solved

how to remove certain entries from an xml node using xslt

Posted on 2011-09-06
3
384 Views
Last Modified: 2013-11-18
I have the following requirement

Remove any entries for <dc:creator>Wiley InterScience (Online service)</dc:creator>
Remove full stops at end of entries
Separate entries with semicolon and space

Example:
<dc:creator>Ousey, Karen.</dc:creator>
<dc:creator>McIntosh, Caroline.</dc:creator>

"Ousey, Karen; McIntosh, Caroline"
0
Comment
Question by:mmalik15
  • 2
3 Comments
 

Author Comment

by:mmalik15
ID: 36491193
I have trying something like below but does not seem to work

<mauthorpersons>
							<xsl:choose>
								<xsl:when test="dc:creator != 'Wiley Inter Science(Online service)'">
									<xsl:value-of select="."/>
									<xsl:text>, </xsl:text>
								</xsl:when>
							</xsl:choose>
						</mauthorpersons>

Open in new window

0
 
LVL 18

Accepted Solution

by:
zc2 earned 500 total points
ID: 36491351
Please look at the sample below. It has two assumptions, so probably need to be elaborated.
<mauthorpersons>
			<!-- Make sure the condition is an exact match! 
			     If it's not, invent more smart way to compare -->
		   <xsl:for-each select="dc:creator[. != 'Wiley InterScience (Online service)']">

			<!-- I assume, it's ok to remove all the dot characters from the string
				 If it's wrong approach, need something more complex -->
				<xsl:value-of select="translate(., '.', '')"/>
				<xsl:if test="position() != last()">
					<xsl:text>; </xsl:text>
    			</xsl:if>
          </xsl:for-each>
		</mauthorpersons>

Open in new window

0
 

Author Closing Comment

by:mmalik15
ID: 36495706
Brilliant mate!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now