Link to home
Start Free TrialLog in
Avatar of GessWurker
GessWurker

asked on

Adjust XSL to handle multiple entries properly - strip out unwanted line breaks

I need to adjust the transform below so that it does NOT insert an unwanted line break as seen in this output example:

      <inm:PDF-Full-Text-Link>\\cas122\PDF\23269562
.pdf
      </inm:PDF-Full-Text-Link>
      <inm:PDF-Full-Text-Link>\\cas122\PDF\23269562suppl.pdf</inm:PDF-Full-Text-Link>

The problem can occur when there are multiple entries in the PDF-Full-Text-Link field and closing tags follow a line break (I think).

How should the transform be adjusted? Here's the code:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:inm="http://www.inmagic.com/webpublisher/query">
    <xsl:output omit-xml-declaration="no" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>
   
    <xsl:template match="inm:PDF-Full-Text-Link[normalize-space(.)]">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:value-of select="concat( '\\cas122\PDF\', .,'.pdf')"/>
        </xsl:copy>
    </xsl:template>  
</xsl:stylesheet>

Some sample input attached.
multiplePDF-sample.xml
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GessWurker
GessWurker

ASKER

Thanks! All good!