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

Re: JScript error handling in msxsl ?

Subject: Re: JScript error handling in msxsl ?
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Fri, 3 Apr 1998 07:09:31 -0500
jscript getattribute
/ Dave Carlson <dcarlson@xxxxxxxxxxxxxx> was heard to say:
| See the example below.  In Microsoft's MSXSL processor, the getAttribute()
| function throws an error and aborts processing of the stylesheet if the
| attribute is not present.  I have a document element with several optional
| attributes, and I want to print those that are present.  I can't find any
| way to make this work, short of creating a whole bunch of alternative rules
| that check for all permutations of  attribute presence in the rule condtion.

You can use style rules if the attributes are inherited.  This
at least reduces the proliferation of rules to an arithmetic
rather than combinatorial explosion.

I have an FOT to HTML stylesheet, it uses the following set of
style-rules and construction rules to handle paragraphs:

<style-rule>
  <target-element type="paragraph">
    <attribute name="space-before" has-value="yes"/>
  </target-element>
  <apply padding-top='=getAttribute("space-before")'/>
</style-rule>

<style-rule>
  <target-element type="paragraph">
    <attribute name="space-after" has-value="yes"/>
  </target-element>
  <apply padding-bottom='=getAttribute("space-after")'/>
</style-rule>

<style-rule>
  <target-element type="paragraph">
    <attribute name="first-line-start-indent" has-value="yes"/>
  </target-element>
  <apply text-indent='=getAttribute("first-line-start-indent")'/>
</style-rule>

<style-rule>
  <target-element type="paragraph">
    <attribute name="start-indent" has-value="yes"/>
  </target-element>
  <apply margin-left='=getAttribute("start-indent")'/>
</style-rule>

<style-rule>
  <target-element type="paragraph">
    <attribute name="color" has-value="yes"/>
  </target-element>
  <apply color='=getAttribute("color")'/>
</style-rule>

<style-rule>
  <target-element type="paragraph">
    <attribute name="font-size" has-value="yes"/>
  </target-element>
  <apply font-size='=getAttribute("font-size")'/>
</style-rule>

<style-rule>
  <target-element type="paragraph">
    <attribute name="font-weight" has-value="yes"/>
  </target-element>
  <apply font-weight='=getAttribute("font-weight")'/>
</style-rule>

<rule>
  <target-element type="paragraph"/>
  <DIV>
    <children/>
  </DIV>
</rule>

If the source instance contains

<paragraph font-size="12pt" color="#FF0000" space-before="1in">...

This transformation sheet correctly generates

<DIV style="font-size: 12pt; color: #FF0000; padding-top: 1in;">...

Some better solution will have to be found, but this works for now...

                                        Cheers,
                                          norm
-- 
Norman Walsh <nwalsh@xxxxxxxxxxxxx> | The most likely way for the world
Senior Application Analyst          | to be destroyed, most experts
ArborText, Inc. (www.arbortext.com) | agree, is by accident. That's
413.549.3868 Voice/FAX              | where we come in; we're computer
                                    | professionals. We cause
                                    | accidents.--Nathaniel Borenstein


 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.