Subject: Re: JScript error handling in msxsl ? From: Norman Walsh <ndw@xxxxxxxxxx> Date: Fri, 3 Apr 1998 07:09:31 -0500 |
/ 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Jade, Chet Ensign | Thread | XSL Tutorial, Norman Walsh |
Re: Calling a script from an xsl, Frank Boumphrey | Date | Re: ANY XSL SCRIPT DEBUGGERS!!!, Norman Walsh |
Month |