[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Xpath predicates question
Subject: Re: [xsl] Xpath predicates question From: Mike Brown <mike@xxxxxxxx> Date: Fri, 16 Aug 2002 19:18:39 -0600 (MDT) |
Amanda Birmingham wrote: > Hi, List, > > I've got a question about using predicates in xpath ... I know you can > select something like > > /library/book[title = MobyDick] You mean /library/book[title = 'MobyDick'] > but can you do something like > > /library/book[title = <xsl:value-of select = "/personal_info/favorite_book" />] Yes, like this... didn't you try it? /library/book[title = /personal_info/favorite_book] Although this example would not actually work, since a well-formed document cannot have both a /library and a /personal_info, but in general, if you get the paths right, it will be fine. Show us your XML and what output you want, if you can't figure it out. Node-sets are tricky when making comparisons. For each book element, you're comparing a set of title elements with a set of favorite_book elements. The comparison will be true if the string-value of any title matches the string-value of any of favorite_book. "string-value" is XPath terminology; it generally means the text content of the node, or the string equivalent of whatever the object is. - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Xpath predicates question, Amanda Birmingham | Thread | Re: [xsl] Xpath predicates question, Amanda Birmingham |
[xsl] Using a parameter to represen, Kathryn . Grant | Date | Re: [xsl] xsl/xslt coding standard, Brian Grainger |
Month |