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

Re: efficient filtering of XML files. ( XML!=content && XSL

Subject: Re: efficient filtering of XML files. ( XML!=content && XSLT!=presentation )?
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Wed, 05 Apr 2000 07:10:11 -0400
xsl if
"Pawson, David" wrote:
> 
>  Mike Brown
> <big snip/>
> >xsl:apply-templates can be very powerful when used to process, for
> >example, a source tree consisting of a purely structural
> >description of a
> >web site, and secondary source trees (retrieved via
> >document()) consisting
> >of presentational variables (colors, text styles, image names and
> >attributes) referenced by the structural tree.
> 
> This made me think. My primary use of XSLT is producing multiple
> media from a single XML master document.
> 
> One of the things I do is ask users not to put 'titles' into the source
> content, saying I can add this at transformation time.
> 
> This means I prefix the contents of <attendees> with
> 'ATTENDEES: '
> 
> I.e. I put content into the stylesheet. This also means I need to duplicate
> this for all media, which is potentially error prone due to typos.
> 
> Mike, are you advocating something along the lines of a function
> which retrieves, from an external source, an appropriate 'styling' for
> the current node? Something like a function get-style(.) which returns,
> in your example, say, a colour, in mine, some heading text?
> 
> For example, given a location such as minutes/rearmatter/attendees
> I am returned the string ATTENDEES.
> 
> Then I could have all my 'fixed content' in a seperate file and make use
> of it in all appropriate media, perhaps even differentiating the media
> with a different parameter, so that I receive back 'formatted' strings
> appropriate to \tex, html, braille etc.
> 
> Definately worth exploring. Thanks Mike.
> 
> Regards, DaveP
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

I do something like this to format a <div> tag that takes its class as
@c, its number as @n and may be nested.  In names.xml I have:

<names>
  <div c="section">Section</div>
  <div c="tablet">Tablet</div>
  <div c="source">Source</div>
  <div c="fragment">Fragment</div>
</names>

and then in the script:

<xsl:template match="div">
  <xsl:text> </xsl:text>
  <xsl:choose>
    <xsl:when test="document('names.xml')/*/div[@c=current()/@c]">
      <xsl:value-of
select="document('names.xml')/*/div[@c=current()/@c]"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:message 
        terminate="no">composite: warning: unknown DIV class
'<xsl:value-of 
                       select="@c"/>'</xsl:message>
      <xsl:value-of select="@c"/>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="string-length(@n)>0">
    <xsl:text> </xsl:text>
    <xsl:value-of select="@n"/>
  </xsl:if>
  <xsl:if test="div"><xsl:text> </xsl:text></xsl:if>
</xsl:template>

Of course, I do this primarily because I want to avoid a lengthy
xsl:when to trap each possible class name, but the same principle could
be used to separate the content from the stylesheet.

 Steve


 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.