[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Moving or removing a period
Subject: Re: Moving or removing a period
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Tue, 18 May 2010 21:19:40 +0200
|
<xsl:template match="text()[preceding-sibling::*[1]/self::link/prompt]">
<xsl:value-of select="replace(., '^\.', '')"/>
</xsl:template>
On 18.05.2010 21:05, Flanders, Charles E (US SSA) wrote:
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|