Solved

how to remove certain entries from an xml node using xslt

Posted on 2011-09-06
3
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

761 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