[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: inline troubles

Subject: RE: inline troubles
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 07 Sep 2006 17:35:40 -0400
RE:  inline troubles
Luke,

This is XSLT.

The rule is, whitespace in a template doesn't count, *except* when it's mixed with non-whitespace text, at which point it gets copied into the result just like all the other text. This is what's happening to you.

(If you think about it, actually, no other rule would be quite sane.)

In order to get around the mess this sometimes causes when we nevertheless wish our templates to be formatted legibly (as in your case), we have <xsl:text>...</xsl:text>:

<xsl:template match="name">
  <xsl:value-of select="name" />
  <xsl:text> : </xsl:text>
  <xsl:apply-templates />
</xsl:template>

(But are you sure you want the value of the first name element child of the name element? That seems rather odd.)

Cheers,
Wendell

At 04:30 PM 9/7/2006, you wrote:
Ok, so I've broken this stuff down into templates, and I *think* I'm
understanding how its handling everything.  However, I seem to be
running into a bit of a formatting nightmare.

Say I want to print someones name followed by a : and then a description
about them.

I have something like this in the xsl

<xsl:template match="name">
<xsl:value-of select="name" /> :
<xsl:apply-templates />
</xsl:template>

<xsl:template match="desc">
<xsl:value-of select="para"/>
<xsl:apply-templates/>
</xsl:template>

So by that method, I'm expecting... name: desc (moves to next line)
However, I'm getting a mixed version of... :name (LFCR)
desc

I'm not sure if this is XSLT or maybe because I'm using FOP.  Anyone run
into this before?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.