how to seperate each entry of a node with a full stop (if one is not already present) using xslt 1.0 or xpath 1.0

hi experts,

My xml is attached. My requirement is to separate each entry of <abst> with full stop (if one not already present) and a space. I have tried something like this in xslt but it does not seem to work

<xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
 
  <xsl:template match="/">
    <records>
      <xsl:for-each select="/ListRecords/record">
        <record>
         
          <body>
          <xsl:for-each select="metadata/ovidrec/abst" >
            <xsl:value-of select='concat(.," ")'   />
            </xsl:for-each>
          </body>
         
          </record>
         
          </xsl:for-each>
          </records>
         
          </xsl:template>
</xsl:stylesheet>


 
<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
	<responseDate>2011-08-12 05:55:03</responseDate>
	<request verb="ListRecords">http://an.oa.org/OAI-script</request>
	<ListRecords>
		<record>
			<header>
				<identifier>ovid:/bib/cochdb/CD000008</identifier>
				<datestamp>2011-08-12</datestamp>
				<setSpec>BibDB:coch</setSpec>
			</header>
			<metadata>
				<ovidrec xmlns="http://ovid.com/rec/elements/1.0/" xsi:schemaLocation="http://ovid.com/rec/elements/1.0/">
					<acno>CD000008</acno>
					<auts>McCarney, Robert W</auts>
					<auts>Brinkhaus, Benno</auts>
					<auts>Lasserson, Toby J</auts>
					<auts>Linde, Klaus</auts>
					<year>2009</year>
					<doct>Reviews</doct>
					<titl>Acupuncture for chronic asthma</titl>
					<suba>Chronic asthma - non-pharmacological interventions</suba>
					<suba>Acupuncture, homoeopathy and herbal remedies</suba>
					<suba>Humans</suba>
					<suba>*Acupuncture Therapy</suba>
					<suba>*Asthma/th [therapy]</suba>
					<suba>Chronic Disease</suba>
					<suba>Randomized Controlled Trials as Topic</suba>
					<jour>Cochrane Database of Systematic Reviews</jour>
					<lang>English</lang>
					<issu>3</issu>
					<upcd>20093</upcd>
					<grpn>Cochrane Airways Group</grpn>
					<pubt>Systematic Review</pubt>
					<ftlk>CD000008</ftlk>
					<abst>Background</abst>
					<abst>Acupuncture has traditionally been used to treat asthma in China and is used increasingly for this purpose internationally.</abst>
					<abst>Objectives</abst>
					<abst>The objective of this review was to assess the effects of acupuncture for the treatment of asthma or asthma-like symptoms.</abst>
					<abst>Search strategy</abst>
					<abst>We searched the Cochrane Airways Group Specialised Register (last searched August 2008), the Cochrane Complementary Medicine Field trials register, AMED, and reference lists of articles. We also contacted trialists and researchers in the field of complementary and alternative medical research.</abst>
					<abst>Selection criteria</abst>
					<abst>Randomised and possibly randomised trials using needle acupuncture or other forms of stimulation of acupuncture. Any form of control treatment was considered (no treatment in addition to conventional asthma treatment, sham or placebo interventions, active comparator interventions). Studies were included provided outcome was assessed at one week or more.</abst>
					<abst>Data collection and analysis</abst>
					<abst>At least two reviewers independently assessed trial quality. A reviewer experienced in acupuncture assessed the adequacy of the active and sham acupuncture used in the studies. Study authors were contacted for missing information.</abst>
					<abst>Main results</abst>
					<abst>Twelve studies met the inclusion criteria recruiting 350 participants. Trial reporting was poor and trial quality was deemed inadequate to generalise findings. There was variation in the type of active and sham acupuncture, the outcomes measured and time-points presented. The points used in the sham arm of some studies are used for the treatment of asthma according to traditional Chinese medicine. Two studies used individualised treatment strategies and one study used a combination strategy of formula acupuncture with the addition of individualised points. No statistically significant or clinically relevant effects were found for acupuncture compared to sham acupuncture. Data from two small studies were pooled for lung function (post-treatment FEV1): Standardised Mean Difference 0.12, 95% confidence interval -0.31 to 0.55).</abst>
					<abst>Authors' conclusions</abst>
					<abst>There is not enough evidence to make recommendations about the value of acupuncture in asthma treatment. Further research needs to consider the complexities and different types of acupuncture.</abst>
				</ovidrec>
			</metadata>
		</record>
		</ListRecords>
</OAI-PMH>

Open in new window

mmalik15Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:

<xsl:stylesheet version="1.0"   
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:oai="http://www.openarchives.org/OAI/2.0/"
    xmlns:ovid="http://ovid.com/rec/elements/1.0/"
    exclude-result-prefixes="oai ovid">
    
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    
    <xsl:template match="/">
        <records>
            <xsl:apply-templates select="//oai:ListRecords/oai:record"/>
        </records>
        
    </xsl:template>
    
    <xsl:template match="oai:record">
        <record>
            <body>
                <xsl:apply-templates select="oai:metadata/ovid:ovidrec/ovid:abst" />
            </body>
        </record>
    </xsl:template>
    
    <xsl:template match="ovid:abst">
        <xsl:if test="not(position() = 1)">
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:value-of select="substring(., 1, string-length(.) - 1)"/>
        <xsl:value-of select="translate(substring(., string-length(.)), '.', '')"/>
        <xsl:text>.</xsl:text>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0
Gertone (Geert Bormans)Information ArchitectCommented:
well, there are a number of namespaces in your source document (as a default namespace)
In your XSLT you need to address them with a prefix
I think that is the main error in your attempt

It is nicer to have apply-templates instead of for-each, so I did that too

The ". " at the end is done like this

- put all but the last character
- put the last character if it is not a dot (done by removing the dot with a translate)
- put a dot, always
- put a space before the string, except at the beginning
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mmalik15Author Commented:
perfect!
0
Gertone (Geert Bormans)Information ArchitectCommented:
welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.