This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: A whitespace question, but probably not the same as the other one s


Well, the problem is that I'm ending up with "acceptedRice's" instead of
"accepted Rice's" due to the page breaks in the XML.  The output of the
stylesheet puts line feeds there, but when I look at the result in Word (the
output is an RTF file), it ignores those and runs the words together.  I'll
try a simpler example.  

I can fix this one with the normalize-space():
XSL:
<xsl:template match="cite4thiscase">
{\ul\cf9 <xsl:value-of select="normalize-space(.)"/>\par }
</xsl:template>

XML:
<lnv:CITE segformat="$T"><cite4thiscase><?DBLOAD
CITING="RSC=7020,RPTR=AKALX,VOL=2001,PAGE=50,LN=Y"?>2001
Alas. LEXIS 50</cite4thiscase></lnv:CITE>

Without the normalize-space(), I end up with 2001Alas. LEXIS 50, which is
wrong.  But I can fix that one with the way the XSL is above.  So far, so
good.

Another one, the XML (like I said, I didn't design it, I just take what they
send me):
<lnv:COUNSEL>Robert A. Sparks, Fairbanks, for Appellant.<nl/><fb/><nl/>Mark
E. Ashburn, Ashburn &amp; Mason, Anchorage, for Appellees.  </lnv:COUNSEL>

Some of the XSL:
<xsl:template match="lnv:COUNSEL">
\par <xsl:text disable-output-escaping="yes">&lt;I&gt;</xsl:text> 
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="nl">
\par<xsl:text xml:space="preserve"> </xsl:text>
</xsl:template>

<xsl:template match="fb">
<xsl:text xml:space="preserve"> </xsl:text>
</xsl:template>


The output:
\par <I>Robert A. Sparks, Fairbanks, for Appellant.
\par

\par
Mark
E. Ashburn, Ashburn & Mason, Anchorage, for Appellees.  

The result when I view it will be "MarkE. Ashburn, Ashburn & Mason,
Anchorage, for Appellees."

Maybe the problem is more basic here.  I think the problem is the text is
not being handled, it is just being dumped out as it comes to it.  I've
tried:
<xsl:template match="lnv:COUNSEL">
\par <xsl:text disable-output-escaping="yes">&lt;I&gt;</xsl:text> 
<xsl:value-of select="normalize-space(.)"/>
<!-- <xsl:apply-templates/> -->
</xsl:template>

and I get:
\par <I> Robert A. Sparks, Fairbanks, for Appellant.Mark E. Ashburn, Ashburn
& Mason, Anchorage, for Appellees.

the "Mark E." is right, but it never calls the <nl> and <fb> so I am missing
the "\par \par" between "Appellant." and "Mark"

Does this all make sense?  It is driving me crazy.  How do I get the
whitespace right and at the same time all the weird random embedded nodes
(the nl and fb) get handled too?  I saw the samples to replace the line
feeds with carriage returns and I suspect that something like that will fix
things, but in light of all the strange stuff embedded all over the place, I
wasn't sure how to implement that.

I almost wonder if I wouldn't be better off just replacing all those stupid
<nl>, <fb>, etc nodes with the real text.  I have to do some processing and
insert things into the DOM that I apply the stylesheet to before hand
anyways.  If I can't figure this one out in the next day or so, I'm just
going to do that when I have the DOM in my Java program before I call Xalan.

Kerry.

-----Original Message-----
From: Mike Brown [mailto:mike@skew.org]
Sent: Thursday, June 07, 2001 10:37 AM
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] A whitespace question, but probably not the same as
the other one s


Nice, Kerry A. (LNG-SHEP) wrote:
> Ok, I've looked through the faq and can't figure this one out.  I have
some
> nodes that I handle directly, so putting normalize-space into a value-of
> fixes the problem like:
> <xsl:if test="@typestyle='un'">
>   {\ul <xsl:value-of select="normalize-space(.)"/>}
> </xsl:if>
> 
> Except I have a bunch of screwy XML (I didn't design it, I just take what
my
> process gets), that I had to handle with this template match="*" node that
a
> helpful person on this list suggested previously.  Basically, there are
> <nl/> tags scattered randomly throughout the document.  I hope this is
> enough information.  The end product is a RTF document.
> 
> The basic problem is for nodes like <p>, I can't figure out where to put a
> normalize-space, so I end up with output like:
> ... accepted
> Rice's  ...
> 
> which ends up as:
> ... acceptedRice's ...
> when you look at the resulting document in Word.

You still haven't said what the problem is, or what you're really trying 
to accomplish.

I suspect what you're really trying to do is replace linefeed characters
with something else? Hard to tell exactly without seeing the actual input 
and the desired output.

   - Mike
____________________________________________________________________________
_
mike j. brown, software engineer at  |  xml/xslt: http://skew.org/xml/
webb.net in denver, colorado, USA    |  personal:
http://hyperreal.org/~mike/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]