Re: [xsl] Conditional indentation?

Subject: Re: [xsl] Conditional indentation?
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Sun, 07 Apr 2002 16:14:01 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 15:02 7/4/02, Ned Batchelder wrote:
>I tried setting a parameter to the stylesheet and then
>using:
>
><xsl:output method='html' indent='{$indent}' />
>
>but the indent attribute is not an attribute value
>template.  First question: why not?

Variables may be set by other top-level elements, and that would require 
that the XSLT engine evaluate all of those variables (potentially deeply 
investigating the source XML) before setting up its output environment.

>I tried creating two small stylesheets, with just
>those <xsl:output> elements in them, and then
>including them:
>
><xsl:include href='{$outputsheet}' />
>
>But again, the href attribute is not an AVT.
>
>Is there any way to accomplish what I want?  Am I
>overlooking something simple?

Make three stylesheets.  Two are very short:

indent.xsl:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0">
<xsl:import href="main.xsl"/>
<xsl:output method="html" indent="yes"/>
</xsl:transform>

noindent.xsl:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   version="1.0">
<xsl:import href="main.xsl"/>
<xsl:output method="html" indent="no"/>
</xsl:transform>

And main.xsl has your actual templates.

HTH,
Chris
- -- 
Christopher R. Maden, Principal Consultant, crism consulting
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.8

iQA/AwUBPLDSuKxS+CWv7FjaEQJVhwCcCcHdZURScBKI98jVbm/7tR6WCI8An2gP
SBfKQTW71PdtWFHq1IZUHHT0
=S7d2
-----END PGP SIGNATURE-----


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread