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

Re: Stylesheet assistance

Subject: Re: Stylesheet assistance
From: Gary L Peskin <garyp@xxxxxxxxxxxx>
Date: Tue, 25 Jul 2000 16:48:44 -0700
Re: Stylesheet assistance
Daniel --

A much briefer version with two simple templates and no parameter
passing.  Many thanks to Nikolai Grigoriev for inspiration regarding the
ancestor:: axis.

Gary

=====================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" />
<xsl:strip-space elements="test"/>

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

<xsl:template match="p">
  <xsl:param name="indent" select="0"/>
  <xsl:variable name="indent" select="count(ancestor::*[ancestor::*/b])
* 12" />
  <xsl:choose>
	<xsl:when test="$indent = 0">
	  <p><xsl:value-of select="."/></p>
	</xsl:when>
	<xsl:otherwise>
	  <p style="{concat('margin-left: ',$indent, 'px')}"><xsl:value-of
select="."/></p>
	</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
===============================================


Gary L Peskin wrote:
> 
> Daniel --
> 
> Well, it's ugly but it does seem to do what you want.  Maybe someone can
> come up with a more abbreviated version.
> ...


 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.