[xsl] Moving or removing a period

Subject: [xsl] Moving or removing a period
From: "Flanders, Charles E (US SSA)" <charles.flanders@xxxxxxxxxxxxxx>
Date: Tue, 18 May 2010 15:05:13 -0400
I need some help moving a period from one context to another. I can identify
where period needs to be inserted but I can't get rid of the existing period.

Here's what a I have so far

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:xs="http://www.w3.org/2001/XMLSchema";
      exclude-result-prefixes="xs"
      version="2.0">
	<xsl:include href="copy.xsl"/>

	<xsl:template match="prompt">
		<xsl:if test="parent::link/following-sibling::text() ='.'">
			<prompt>
				<xsl:value-of select="."/><xsl:text>.</xsl:text>
			</prompt>
		</xsl:if>
	</xsl:template>

A snippet of the pertinent XML looks something like this: (there's a whole lot
more to this document, hence the "copy.xsl" include).

<para>
<link linkaction="prompt" linktype="goto" xlink:href="IETM://M00206"
xmlns:xlink="http://www.w3.org/1999/xlink"; xreftype="wp">
<prompt>This is the content stuff</prompt>
</link>.
</para>

I can get the period into the <prompt> element but I can't seem to find a good
way to eliminate the period after the <link> end tag. I cannot perform a
simple search and replace because there are cases when a <link> element does
NOT have a child <prompt> element, so that period needs to remain. I only want
to eliminate "." when <link> contains a child <prompt>.

The parent of <link> is usually either <para> or <trim.para>.



C Flanders

Current Thread