Conditional actions in XSL?

Henry Thompson ht at cogsci.ed.ac.uk
Wed Jan 28 15:11:28 GMT 1998


Richard Light <richard at light.demon.co.uk> writes:

> The conditions for XSL are set by the structure that you specify, e.g.:
> 
>     <element type="object">
>         <target-element>
>               <attribute name="REND" has-value="yes"/>
>         </target-element>
>     </element>
> 
> . . .
>
> I'm not sure about the ability to invoke a bit of script when testing
> the attribute value.  The XSL spec allows you to invoke ECMAscript when
> _setting_ attribute values on (output) flow objects - there is no reason
> at all why it couldn't allow the same feature when _testing_ attribute
> values on source elements.  (Obviously in this case the script would
> have to return true/false rather than a string.)

You're right, in XSL as currently proposed you can't do that, but it
is consistent with the existing (but unimplemented) part of the DSSSL
model of construction rules via the 'query' construction rule, so not
out of the question in principle.

> When trying out a bit of code to show how easy this all is, I couldn't
> get MSXSL to take any notice of an <attribute> statement inside a
> <target-element> as per the above example.  But I think it should have
> done!
> 
> One point is that the spec uses both 'name="XXX"' and 'type="XXX"' to
> qualify <attribute> in its examples in 3.2.3.  I think, though, that the
> 'type="XXX"' is an error.  (Neither worked with MSXSL.)

'name=...' is correct for the 'attribute' element type.  I haven't tried
MSXSL much, but their examples show patterns which use it, so I'm
surprised, because I can't make it work either.

ht
-- 
Henry S. Thompson, Human Communication Research Centre, University of Edinburgh
      2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
               Fax: (44) 131 650-4587, e-mail: ht at cogsci.ed.ac.uk  
                      URL: http://www.cogsci.ed.ac.uk/~ht/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list