[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Normalizing space / XPTY0004


Subject: Re: [xsl] Normalizing space / XPTY0004
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Tue, 30 Jul 2013 01:08:07 +0200

Try
<xsl:value-of select="./TextRun/Text/@value" separator=""/>
or
<xsl:value-of select="string-join(./TextRun/Text/@value, '')" />

On 30.07.2013 00:55, Lief Erickson wrote:
Hi All--

XSLT 2.0
Saxon EE 9.5.0.2 (in oXygen 15.0)

I have a question about normalizing space -- at least I think that's what my question is about. I am matching the following TextRun/Text values, but the output is putting a space either after the end of the line or before the beginning (I can't tell which). That makes the word "are" become "ar e" and "larger" become "lar ger" and "unchanged" become "unchang ed". Obviously this is not my desired result, but the processor is dutifully matching exactly what it finds.

       <Paragraph stylename="Body">
          <TextRun>
             <Text value="If enabled, only the first N-bytes of each ingress packet ar"/>
             <Text value="e forwarded to Tool Ports connected to the rule. Packets lar"/>
             <Text value="ger than the trim length are 'trimmed' to the size specified"/>
             <Text value=". Packets smaller than the trim length are forwarded unchang"/>
             <Text value="ed."/>
          </TextRun>
       </Paragraph>


<xsl:template match="Paragraph[@stylename = 'Body']"> <xsl:value-of select="./TextRun/Text/@value"/> </xsl:template>

Output:
If enabled, only the first N-bytes of each ingress packet ar e forwarded to Tool Ports connected to the rule. Packets lar ger than the trim length are 'trimmed' to the size specified . Packets smaller than the trim length are forwarded unchang ed.

I tried <xsl:value-of select="normalize-space(./TextRun/Text/@value)"/>, but I get error XPTY0004.

Can someone explain how I should be properly connecting the Text/@value entries in this TextRun so that my words are whole?

-Lief


Current Thread
Keywords