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

Re: attributes and elements

Subject: Re: attributes and elements
From: "Bruce D'Arcus" <bdarcus@xxxxxxxxxxx>
Date: Fri, 5 Dec 2003 18:51:16 -0500
xsl attributes
J.Pietschmann wrote:

Bruce D'Arcus wrote:
                <content>
--->                    <xsl:if test="*/condition">
--->                        <xsl:apply-templates/>
--->                    </xsl:if>


The test test, whether one of the child elements of the section element has a condicion element as child. I just can't quite match the XSLT with your problem spec, as a rather wild guess I'd say try: ... <content> <xsl:apply-templates mode="filter-condition"/> ...

  <xsl:template match="*[@condition='screen']"
     mode="filter-condition">
     <xsl:apply-templates/>
  </xsl:template>

<xsl:template match="node()" mode="filter-condition"/>

I've put together a stripped down example. Let's say here's my instance:


<section>
<title>title</title>
<p>Some text to become <q type="screen">a bullet</q> here.</p>
</section>

I just want output like:

<h1>title</h1>
<content>
	<bullet>a bullet</bullet>
</content>

I can't seem to get that. Here's the xslt, using your example:

----------------------
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='xml' version='1.0' encoding='utf-8' indent='yes'/>


<xsl:template match="section">
	<h1>
		<xsl:apply-templates select="title"/>
	</h1>
    <content>
      <xsl:apply-templates mode="filter-condition"/>
	</content>
</xsl:template>

<xsl:template match="*[@type='screen']" mode="filter-condition">
     <bullet>
		<xsl:apply-templates/>
	</bullet>
</xsl:template>

<xsl:template match="node()" mode="filter-condition"/>

</xsl:stylesheet>
------------------------
Bruce


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.