Solved

how to remove certain entries from an xml node using xslt

Posted on 2011-09-06
3
387 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

738 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