[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Possible to use attribute value in pattern ??
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
|
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
|