xsl-list
[Top] [All Lists]

RE: Newline problems

2003-05-05 17:12:56
Ok, this thread is getting boring. :)

Here is what I see as the main problem with the logic
of the sheet as it stands (if I am reading it
correctly).

This

<xsl:template mode="stripNewline"  match="text()">
  <xsl:value-of select="normalize-space(.)"/>
</xsl:template>

Will normalize-space on the text node =>IF<= 

<xsl:template mode = "Attribs" match = "info">
  <xsl:apply-templates mode="stripNewline"
select="text()"/>
   <xsl:element name = "PO_NUMBER">
    <xsl:value-of
select="attr/atomicValue[../name='ponumber']"/>
   </xsl:element>
   ...
</xsl:template>

"[LF]ponumber" = "ponumber". Which it never will. So
the text nodes will never be "cleaned".

So you are in a catch 22 if you refuse to use 
...
select="attr/atomicValue[normalize-space(../name)='ponumber']"/>

People use trim() all the time on Char values from a
database or input from the console. As I see it (and I
am by no means a Guru) You have several things you can
do - all of which have been given to you already.

1. Have the original xml manipulated first. As Michael
said.
2. Use normalize-space() on the item you are testing
3. Perhaps ../name = '[lf]ponumber' would work?
4. Don't use xslt, find another solution

Cheers, and good luck
Rob

    _/  _/_/    _/_/_/
   _/_/   _/ _/     _/
  _/               _/
 _/             _/
_/          _/_/_/_/
http://treebeard.sourceforge.net
http://ashpool.sourceforge.net

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



<Prev in Thread] Current Thread [Next in Thread>