Solved

how to remove certain entries from an xml node using xslt

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tutorial for ebay api 3 32
Problem with SQL Script - Cannot call methods on char 2 20
Eliminate additional border 1 18
MS SQL + Insert Into Table - If Doesnt Exist 9 32
In this article I will describe the Detach & Attach 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.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

785 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