[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: "Allan Jones" <allan.jones@xxxxxxxxxxxx>
Date: Thu, 10 Apr 2003 10:37:21 +0100
RE:  Newbie Q: Why are element contents being passed th
I've had a quick look at this, and there's a couple of problems.

Firstly, the input document contains an <input> element that hasn't been
closed:

<openingtime>
		<label>Opening Time</label>
		<input type="select" option="singlechoice">
		<option value="10:00">10:00</option>

This needs to be closed if you want to use this as an xml input document
(i.e. </input> after the list of options, as in the following input).

The main problem, though, is that you're not taking the default
templates into account:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="*|/">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="text()|@*">
		<xsl:value-of select="."/>
	</xsl:template>
	<xsl:template match="*|/" mode="?">
		<xsl:apply-templates mode="?"/>
	</xsl:template>
	<xsl:template match="text()|@*" mode="?">
		<xsl:value-of select="."/>
	</xsl:template>
	<xsl:template match="processing-instruction()|comment()"/>
	<xsl:template match="processing-instruction()|comment()"
mode="?"/>
</xsl:stylesheet>

These templates are automatically included whenever you create an xsl.
Your apply-templates call within the form template is calling on these
templates, and as you can see, whenever it finds a text node it'll
output the value of that node in your output document, causing the
output you see.

What you'll have to do is create a set of templates matching the rest of
the elements in your document to control how they'll be output in your
document.  If you're just going to copy them over, however, you could
just replace the call to apply-templates with a for-each loop that will
make a copy-of each child element:

<xsl:for-each select="*">
	<xsl:copy-of select="."/>
</xsl:for-each>


Hope that helps,

b


 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.