[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Type-based design patterns
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 / Jeni Tennison <jeni@j...> 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@S... | 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-----
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|