OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Does WTSIWYG make simplicity moot?

[ Lists Home | Date Index | Thread Index ]

On 13 Nov 2002 at 11:49, Jeff Lowery wrote:

> Example:
> <rect x="10" y="10" width="50" height="30" style="stroke: black; fill:
> none;"/>
> The style attribute contains structured content. This means in addition to
> an XML parser, there has to be a stylesheet parser.

It also makes XSLT processing vastly more complicated. Say you want
to change the fill color on all filled objects to 'blue', but leave
the unfilled ones alone. With discrete style attributes, you can do

  <xsl:apply-templates select="@fill"/>

  <xsl:template match="@fill[normalize-space() = 'none']">
    <xsl:copy-of select="."/>

  <xsl:template match="@fill">
    <xsl:attribute name="fill">blue</xsl:attribute>

Whereas if you use the single 'style' attribute, you have to resort
to something ugly and inefficient like:

  <xsl:call-template name="process-style">
    <xsl:with-param name="style" select="@style"/>

  <xsl:template name="process-style">
    <xsl:param name="style"/>
    <xsl:variable name="property"
    <xsl:variable name="property-name"
      select="normalize-space(substring-before($property, ':'))"/>
    <xsl:variable name="property-value"
      select="normalize-space(substring-after($property, ':'))"/>
    <xsl:attribute name="$property-name">
        <xsl:when test="$property-name='fill' and
        <xsl:when test="$property-name='fill'">
          <xsl:value-of select="$property-value/>
    <xsl:variable name="remainder"
    <xsl:if test="$remainder">
      <xsl:call-template name="process-style">
        <xsl:with-param name="style" select="$remainder"/>

Ow! That's even worse than I thought. I've never actually done that
before, just thought about it.

Matt Gushee


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS