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

Re: struggling with avt's

Subject: Re: struggling with avt's
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 30 Jul 2002 09:52:20 +0100
xsl wiz
Dave,

> Thanks David.
> Cleared most of it up.
>
> I'll carry on at least knowing I'm going in the right direction :-)

I'm just a bit worried that you've misinterpreted what David was
saying. You're going to find it very difficult (read impossible in the
general case) to go from:

<doc>
 <para html='p' pdf='fo:block' attset='para font'>This is .... </para>
</doc>

via a single stylesheet including attribute sets for 'para' and 'font'
to get to an XSL-FO document that includes the attributes defined in
that attribute set in just one step.

Perhaps this is what you're doing at the moment anyway, but I think
the easiest thing will probably be to have two steps, where the first
creates a stylesheet that includes literal result elements with
xsl:use-attribute-sets attributes on them (plus the definitions of the
attribute sets themselves) and the second runs that stylesheet
(processing the xsl:use-attribute-sets attributes) to create the final
XSL-FO that you're after.

So your first stylesheet would look something like:

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

<xsl:namespace-alias stylesheet-prefix="#default"
                     result-prefix="xsl" />

<xsl:template match="/">
  <stylesheet version="1.0">
    <include href="attribute-sets.xsl" />
    <template match="/">
      <xsl:apply-templates />
    </template>
  </stylesheet>
</xsl:template>

<xsl:template match="*[@pdf]">
  <xsl:element name="{@pdf}">
    <xsl:attribute name="xsl:use-attribute-sets">
      <xsl:value-of select="{@attset}" />
    </xsl:attribute>
    <xsl:apply-templates />
  </xsl:element>
</xsl:template>
                
</xsl:stylesheet>

which would create:

<stylesheet version="1.0"
            xmlns="http://www.w3.org/1999/XSL/Transform"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:fo="http://www.w3.org/1999/XSL/Format">
            
<include href="attribute-sets.xsl" />

<template match="/">
  <fo:block xsl:use-attribute-sets="para font">
    This is ...
  </fo:block>
</template>
            
</stylesheet>

When that stylesheet is run (on anything) then it will create the
XSL-FO, with the attribute sets resolved.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread
  • struggling with avt's
    • DPawson - Mon, 29 Jul 2002 10:11:43 -0400 (EDT)
      • <Possible follow-ups>
      • DPawson - Mon, 29 Jul 2002 11:23:15 -0400 (EDT)
        • Jeni Tennison - Tue, 30 Jul 2002 04:52:18 -0400 (EDT) <=
      • DPawson - Tue, 30 Jul 2002 06:18:21 -0400 (EDT)

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.