Subject: Re: Possible to use attribute value in pattern ??
From: cjdrake@xxxxxxxxxxxxxxxx
Date: Thu, 15 Jul 1999 19:14:32 GMT
|
Some background: This sub-thread was started by my co-worker. We were
puzzling over the attributes vs. sub-elements for fields issue.
We decided to use sub-elements because we could not individually style
attributes (since a template rule cannot match an attribute, only its
element).
>> you wanted to create choice box or list with all @name values. You
>> could match the pattern, but then could never revisit the element to get
>> information about its content or its other attribute values.
>
> why not?
> you can either process using different modes, or you
> just select in with different patterns, as often as you like.
Perhaps, we're wrong, but our understanding of the spec and our experience
with SAXON is that a particular source element can only be matched once
during the styling process. Suppose the source document has:
<book title="All About Foo" author="Dr. Quux"/>
and I want to place the title in one part of the result tree and the author
in another. To do so, I might have
<xsl:apply-templates select="book[@title]"/>
in one place, and
<xsl:apply-templates select="book[@author]"/>
in the other. The problem is that both apply-templates "calls" match the
same
source element so only one of them gets generated. In addition, the
template
rule triggered by these two apply-templates tags cannot distinguish which
apply-templates "call" triggered the rule, so it doesn't know which
attribute
to style (I'm guessing that this can be handled with a variable).
Am I missing or misunderstanding something? Is it possible for the
processor
to apply more than one template rule for the same source element, e.g. if a
different mode is used for each apply-templates and correpsonding template
rule?
Would I then need a different mode for each attribute that I'm styling
separately?
:Caleb Drake, ThoughtWorks, LLC
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|