cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Koberg" <...@koberg.com>
Subject RE: Spacing issues?
Date Tue, 10 Jun 2003 23:01:44 GMT
Hi,

Andre was a bit off with his comments. Also he is using a long-hand version
when there is a simpler way to accomplish it (attribute value templates or
{} in an attribute). Joerg was showing you how to "strip" the leading and
trailing whitespace from your "report-name" element's value.

This is a common requirement when you need to place element content in an
attribute. So you are not using a variable in this case (though you could).
Think about this:

<report-name>
  My report
</report-name>

Just using this value would give you:

<elem id="
  My Report
"/>

You use the normalize-space function to get rid of the extra whitespace so:

<elem id="{normalize-space(report-name)}"/>

Becomes:
<elem id="My Report"/>


I would recommend you both get Mike Kay's XSLT book from Wrox (if it still
out there...), or perhaps Jeni Tennison's Xpath book as it is more geared to
beginners. I wouldn't recommend XML in a Nutshell as an XSL book.

Best,
-Rob

> -----Original Message-----
> From: Tim Bachta [mailto:tbachta@kopent.com]
> Sent: Tuesday, June 10, 2003 3:49 PM
> To: cocoon-users@xml.apache.org
> 
> I do not have a xsl:variable named "report-name"  how do I declare that?
> I am going to get that book this evening.
> 
> -----Original Message-----
> From: Andre Thenot [mailto:at01@thenot.net]
> Sent: Tuesday, June 10, 2003 4:30 PM
> To: cocoon-users@xml.apache.org
> Subject: Re: Spacing issues?
> 
> That was an XPath expression.
> 
> Use (assuming you have an xsl:variable named "report-name"):
> 
> <div id="panel_sw{report-name}" class="dlgPanel">
> <xsl:attribute name="id">panel_sw<xsl:value-of select="normalize-
> space($report-name)"/></xsl:attribute>
> </div>
> 
> Further reading: XML in a nutshell, published by O'Reilly, look
> at chapter on XSL.
> 
> A.
> 
> On Tuesday, June 10, 2003, at 05:19 PM, Tim Bachta wrote:
> 
> > Where do I put that?
> >
> > -----Original Message-----
> > From: Joerg Heinicke [mailto:joerg.heinicke@gmx.de]
> > Sent: Tuesday, June 10, 2003 3:06 PM
> > To: cocoon-users@xml.apache.org
> > Subject: Re: Spacing issues?
> >
> > {normalize-space(report-name)}
> >
> > Joerg
> >
> > Tim Bachta wrote:
> >> How come I am getting huge amounts of space between hard-coded items
> > and
> >> database items in my view source when they should be no space
> > according
> >> to my code?
> >>
> >>
> >>
> >> Ex.
> >>
> >> Code = <div id="panel_sw{report-name}" class="dlgPanel"> I would
> > expect
> >> <div id="panel_swReportName" class="dlgPanel">
> >>
> >>
> >>
> >> Source = <div class="dlgSwitch" id="sw
> >>
> >>                                                             Overdue
> > Task
> >> Report
> >>
> >>                                                      ">
> >>
> >> * *
> >>
> >>
> >>
> >> Tim Bachta
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> --
> André Thénot - andre@thenot.net
> p  e  a  c  e  :  p  a  i  x  :  p  a  x  :  s  h  a  l  o  m
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message