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

RE: Newbie Q: Why are element contents being passed th

Subject: RE: Newbie Q: Why are element contents being passed through?
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 10 Apr 2003 09:59:41 +0300
xslt build in template rules
Hi,

> I have an xml source doc which I want to turn into an xhtml document 
> with a form, inputs, labels and so forth. What is happening 
> is that the 
> contents of the elements in the xml document are turning up in the 
> output and I can't understand why. I have simplified the xml 
> and the xsl 
> until there is almost nothing happening, and the element 
> contents still 
> come through.

In your stylesheet you have

  <xsl:apply-templates/>

which means

  <xsl:apply-templates select="node()"/>

see <http://www.w3.org/tr/xslt#section-Applying-Template-Rules>. Thus, you're also processing text nodes--select only the nodes you want to process.

Still, that's not the problem here, but rather that you have template only for "rateshop" and "form" elements. In the template for "form" you process all child nodes, and in the absence of templates for the child elements of form, the build-in templates kick in--see <http://www.w3.org/tr/xslt#built-in-rule>. The build in templates output all descendant text nodes in your case.

> What can I do? Any help will be appreciated. (And if there is 
> any way to 
> deal with the bizarre spacing in the output document that would be 
> appreciated too!)

Strip the unneeded whitespace from the source tree and add indentation to the output--see <http://www.w3.org/TR/xslt#strip> and <http://www.w3.org/TR/xslt#output>.

Cheers,

Jarno - C-Drone Defect: Psycho2vii

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


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.