This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: struggling with avt's


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]