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] Objections to / uses of PSVI?

[ Lists Home | Date Index | Thread Index ]


> That's one reason that I asked how people intended to use the PSVI.
> I find it interesting that the answer has, so far, been silence.

I can think of three ways in which I'd like to use information
available in the PSVI within XSLT:

1. I'd like to be able to have a template that matches all elements in
a certain group, for example "all block elements". Mostly those groups
should be formed around substitution groups, but all elements in that
group having the same type would be another way of doing it.

Here's a real-world example. I have some document-oriented XML in
which things like lists and block quotes can be embedded within
paragraphs, and I want to transform it to HTML, where that's not
allowed. With vanilla XML+XSLT 2.0, I can do something like:

<xsl:function name="my:is-block-element">
  <xsl:result select="self::orderedList | self::unorderedList |
                      self::definitionList | self::blockquote |
                      ..." />

<xsl:template match="para">
  <xsl:for-each-group select="node()"
      <xsl:when test="my:is-block-element()">
        <xsl:apply-templates select="current-group()" />
          <xsl:apply-templates select="current-group()" />

I'd like the fact that the various "block-level" elements were
"block-level" elements to be something recorded declaratively, in a
schema, rather than procedurally, as code. Importantly, the assignment
of "block-level" status is something that's only relevant in the
context of this transformation to HTML. If I was transforming to
DocBook, for example, there might be a different classification.

2. Schemas seem like a good place to store information that's used
across transformations, such as the mapping between codes and full
values. I'd like to have access to the PSVI so that I can have access
to the contents of appinfo elements from within the stylesheet. I gave
the following example on XSL-List yesterday:



  <xs:element name="flavour" default="VNL">
          <flavour code="VNL">Vanilla</flavour>
          <flavour code="CHC">Chocolate</flavour>
          <flavour code="MNT">Mint</flavour>
          <flavour code="CFE">Coffee</flavour>
      <xs:restriction base="xs:token">
        <xs:enumeration value="VNL" />
        <xs:enumeration value="CHC" />
        <xs:enumeration value="MNT" />
        <xs:enumeration value="CFE" />

leading to the text:

  Your favourite ice cream is Chocolate

3. I'd like keys to get automatically set up based on the identity
constraints in the PSVI. Rather than having to write:

<xsl:key name="lessons"
         use="concat(generate-id(parent::class), '+',
                     @date, '+', subject)" />

I'd like to have the following in the schema:

<xs:element name="class" type="classType">
  <xs:key name="lessons">
    <xs:selector xpath="lesson" />
    <xs:field xpath="@date" />
    <xs:field xpath="subject" />

This is particularly because it's easy to scope keys in XML Schema
whereas it's pretty fiddly with XSLT; also because XML Schema keys
have multiple fields.



Jeni Tennison


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

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