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

Newbie question--applying templates, selecting paragra

Subject: Newbie question--applying templates, selecting paragraphs
From: Grant-Kathryn@xxxxxxxxxxxxxxxxx
Date: Thu, 23 May 2002 12:04:14 -0700
paragra
Hi all,

I have an xHTML file to which I need to apply a style sheet in order to copy
CERTAIN paragraphs to a new HTML file.  Now of course, as a newbie, I didn't
know how to do this.  After searching the archives, I found code that copies
ALL paragraphs to the new file.  So this is what I have so far:

----------------------xHTML file--------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<title>Testing Title</title>
</head>
<body>
	<div class="mgronly">
		<p>The first paragraph applies only to managers.</p>
	</div>
	<div class="both">
		<p>Paragraph 2 applies to both investigators and
managers.</p>
		<p>The third paragraph to both.</p>
	</div>
	<div class="mgronly">
	<p>The last paragraph applies only to managers.</p>
	</div>
</body>

</html>
--------------------end xHTML file--------------------------------

---------------------- XSL file-----------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

	<xsl:output method="xml" encoding="UTF-8"/>

	<!-- Match the root node -->
	<xsl:template match="*">
		<xsl:apply-templates select="*"/>
	</xsl:template>

	<!-- Handle any node not yet matched -->
	<xsl:template match="*|@*|text()|comment()">
		<xsl:copy>
			<xsl:apply-templates
select="*|@*|text()|comment()"/>
		</xsl:copy>
	</xsl:template>

</xsl:stylesheet>
---------------------- XSL file-----------------------------------

----------------------- Result -----------------------------------
The first paragraph applies only to managers.

Paragraph 2 applies to both investigators and managers.

The third paragraph to both.

The last paragraph applies only to managers.
----------------------- Result -----------------------------------

So far so good.  But now, when I try to modify the XSL file so only <div>'s
with a certain class are copied out, nothing works.  I either get a blank
screen or I get the title text and all the paragraphs strung together with
no breaks between them.  I could tell you everything I've tried, but it
would probably be faster if someone could just explain how to modify the xsl
file so it copies out only <div>'s of a certain class.

Just when I think I've understood something in XSL, I try code that seems
like it should work and it doesn't.  Very confusing.  So I really appreciate
the help.

Kathryn

 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.