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

RE: *[@new='yes']

Subject: RE: *[@new='yes']
From: Richard Lander <rlander@xxxxxxxxxxxxx>
Date: Tue, 6 Feb 2001 07:26:38 -0800
yes p
 Morning,

I believe that you have three options:

<xsl:template match="p[@new='yes']
                    |h[@new='yes']"
                    >
  <!--do something -->
</xsl:template>

or

<xsl:variable name="defaultCSS" select="'color=red'"/>

<xsl:template match="p[@new='yes']">
  <p style="font-size:12pt;{defaultCSS};">
    <xsl:apply-templates/>
  </p>
</xsl:template>

<xsl:template match="h[@new='yes']">
  <h1 style="font-size:18pt;{defaultCSS};">
    <xsl:apply-templates/>
  </h1>
</xsl:template>

or (best IMO)

<xsl:template match="/"
  <HTML>
    <HEAD>
      <STYLE type="text/css">

        h1   {font-size:18pt}
        p    {font-size:12pt}
        h1,p {color:red}
      </STYLE>
    </HEAD>
    <xsl:apply-templates/>
  </HTML>
</xsl:template>

<xsl:template match="p[@new='yes']">
  <p>
    <xsl:apply-templates/>
  </p>
</xsl:template>

<xsl:template match="h[@new='yes']">
  <h1>
    <xsl:apply-templates/>
  </h1>
</xsl:template>

Hope that helps,

Rich
-----Original Message-----
From: Gustaf Liljegren [mailto:gustaf.liljegren@xxxxxx]
Sent: Tuesday, February 06, 2001 3:03 AM
To: xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx
Subject:  *[@new='yes']


Hello,

I'm been playing with a sample where I'm trying to get all new parts of a 
document to show up in red, using XSL FO. There are headers, paragraphs and 
other typical document elements. All of them can have a new attribute with 
the value "yes", like this:

<?xml version="1.0"?>
<test>
   <h>This is a header, but it's not new.</h>
   <p>This paragraph is not new.</p>
   <p>This paragraph isn't new either.</p>
   <p new="yes">This paragraph is new.</p>
   <p>This isn't.</p>
   <h new="yes">This header is new</h>
   <p>Another paragraph. Not new.</p>
   <p new="yes">Another paragraph. New.</p>
</test>

The problem is that both headers and paragraphs has their default 
appearance too, and I haven't found a good way to just add the attribute 
color="red". Of course I could make separate templates, like p[@new='yes'] 
and h[@new='yes'], but this means I must define their default appearance
twice.

Regards,

Gustaf Liljegren


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

 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.