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

Applying lists outside of paragraphs

Subject: Applying lists outside of paragraphs
From: "Spencer Tickner" <spencertickner@xxxxxxxxx>
Date: Wed, 20 Sep 2006 09:53:51 -0800
xsl apply templates paragraph
Hi List,

Thanks in advance for the help. I'd like to blame this one on Monday,
except for the fact that it isn't...

I'm attempting to apply-templates to my paragraph elements and then
apply-templates to my list elements as the list elements are currently
embedded in the paragraph elements.

INPUT

<?xml version="1.0"?>
<para.appl>Blah Blah <term>foo</term> to <term>bar</term> for
	<term>foo</term>, Blah Blah:
	<list.appl>
		<listitem.appl>Bullet 1</listitem.appl>
		<listitem.appl>Bullet 2 <term refid="wtr-tm">bar</term></listitem.appl>
	</list.appl>
</para.appl>


XSL


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

<xsl:template match="/">
	<xsl:apply-templates/>
</xsl:template>

<!-- This is the weird Part -->
<xsl:template match="para.appl">
<p><xsl:apply-templates select="*[not(descendant-or-self::list.appl)]"/></p>
<xsl:apply-templates select="list.appl"/>
</xsl:template>

<xsl:template match="list.appl">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>

<xsl:template match="listitem.appl">
<li><xsl:apply-templates/></li>
</xsl:template>

<xsl:template match="term">
<em><xsl:apply-templates/></em>
</xsl:template>

</xsl:stylesheet>


OUTPUT


<p><em>foo</em><em>bar</em><em>foo</em></p><ul>
		<li>Bullet 1</li>
		<li>Bullet 2 <em>bar</em></li>
	</ul>


DESIRED OUTPUT


<p>Blah Blah <em>foo</em> to <em>bar</em> for
	<em>foo</em>, Blah Blah:</p>
	<ul>
		<li>Bullet 1</li>
		<li>Bullet 2 <em>bar</em></li>
	</ul>


I can't quite figure out why <xsl:apply-templates select="*[not(descendant-or-self::list.appl)]"/> does not want to apply the default text() template. I've also tried no axis, child::, descendant:: and even self:: but none give the desired output... Any ideas? I'm using Saxon 8.7.1

Thanks in advance for the help

Spencer

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.