Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old October 28th, 2014, 12:42 PM
Friend of Wrox
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default Removing ; at the end of line

How do I remove the colon if there is only one name and if there is only one address?
I have the following Xslt result which includes a ; at the end. The purpose for the colon is only to separate the names or address. If there is only one name, there is no need for the colon. If there is only one address there is no need for the colon.
XSLT Code/Results
Code:
<ext:ProtectionOrderCondition>
	<ext:ConditionText>Stay away from the residence of the Protected Person(s). Jane, Doe; Mellon, Joking;  793 Funny RD, St Jeanne, DC, 77894; 700 Market ST, St Jeanne, DC, 77894; </ext:ConditionText>
</ext:ProtectionOrderCondition>
<ext:ProtectionOrderFinding>
	<ext:FindingText>Respondent has health insurance available for: Jane, Doe; </ext:FindingText>
</ext:ProtectionOrderFinding>
<ext:ProtectionOrderFinding>
	<ext:FindingText>These parties need order for protection": Joking, Mellon; Doe, Jane; </ext:FindingText>
<ext:ProtectionOrderFinding>
XML Code for both Finding and Condition
Code:
<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty[@InternalPartyID=current()/@InternalPartyID]">
	<xsl:value-of select="ProtectionOrderPartyNames/ProtectionOrderPartyName[@Current='true']/@FormattedName"/>
	<xsl:text>; </xsl:text>
</xsl:for-each>

<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty[@InternalPartyID=current()/@InternalPartyID]">
	<xsl:value-of select="ProtectionOrderPartyNames/ProtectionOrderPartyName[@Current='true']/@FormattedName"/>
	<xsl:text>; </xsl:text>
</xsl:for-each>
The desired xslt output should look like this with no colon at the end:
Code:
<ext:ConditionText>Stay away from the residence of the Protected Person(s). Jane, Doe; Mellon, Joking;  793 Funny RD, St Jeanne, DC, 77894; 700 Market ST, St Jeanne, DC, 77894</ext:ConditionText>
Code:
<ext:FindingText>Respondent has health insurance available for: Jane, Doe</ext:FindingText>
Code:
<ext:FindingText>These parties need order for protection": Joking, Mellon; Doe, Jane</ext:FindingText>
 
Old October 28th, 2014, 01:38 PM
Friend of Wrox
 
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default resolved

Resolved today on my own





Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle back-end MS-Access 2003 client front-end Corey Access 2 February 16th, 2007 08:31 AM
removing the reserved line for the xml tag muki XSLT 2 November 2nd, 2005 04:01 AM
Read LF(Line Feed) at the end of the lines rylemer Pro VB 6 1 April 30th, 2004 02:16 AM
Outputting an end of line y_simonson XSLT 1 February 5th, 2004 05:57 AM





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