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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Type-based design patterns

[ Lists Home | Date Index | Thread Index ]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

/ Jeni Tennison <jeni@jenitennison.com> was heard to say:
[...]
| I agree with this, very much. Actually I think we can break this
| pattern down into two classes:
|
|   1. grouping elements based on their *content* -- in other words, the
|      *type* hierarchy
|
|   2. grouping elements based on their *context* -- in other words, the
|      *substitution group* hierarchy
|
| An example of 1 is dealing with all addresses in the same way, whether
| the element that holds the address is a <buyerAddr> or <supplierAddr>
| element.
|
| An example of 2 is dealing with all block-level elements in the same
| way, whether they're paragraphs, tables or lists (all of which have
| very different content).

As I consider the design of an XML Schema for DocBook, I wonder if I
need to be thinking more explicitly in terms of supporting 2 by
having, for example, all the list elements in the same substitution
group. I'm more inclined to use model groups, but maybe that's just
old design patterns.

As I think about 2 though, I'm struck that I'm going to need the
equivalent of "next-match" in order for it to be useful.

<xsl:template match="~ListType">
  <!-- some general stuff about all lists -->
  <xsl:next-match/>
  <!-- some general stuff about all lists -->
</xsl:template>

<xsl:template match="orderedlist">
  <!-- some stuff about ordered lists -->
</xsl:template>

I'm not going to feel like I got much benefit out of the type-based
matching if I have to write:

<xsl:template match="~ListType">
  <!-- some general stuff about all lists -->
  <xsl:choose>
    <xsl:when test="local-name(.) = 'orderedlist'">
    </xsl:when>
    <xsl:when test="local-name(.) = 'itemizedlist'">
    </xsl:when>
    <!-- ... -->
  </xsl:choose>
  <!-- some general stuff about all lists -->
</xsl:template>

                                        Be seeing you,
                                          norm

- -- 
Norman.Walsh@Sun.COM    | Nothing will ever be attempted, if all
XML Standards Architect | possible objections must be first
Sun Microsystems, Inc.  | overcome.--Dr. Johnson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>

iD8DBQE9m1pHOyltUcwYWjsRAhBfAJ9Yuta4LWSaPqZFKglBGC8X5RyWjACgoa/2
Maxlo1SUCV0QZ9kOdSuCQ2E=
=01+g
-----END PGP SIGNATURE-----




 

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

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