[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XSL Help!!
Hi Sara. In this example <xsl:apply-templates select='person_name/person_name.type_cd/@V="L"'/> he's not getting the attribute but the result of (attribute equals to the string 'L'), i. e., is getting true or false. To get the attribute he will also have to use predicates: <xsl:apply-templates select='person_name/person_name.type_cd/@V[.="L"]'/> In this case I think that will be an error since you're not selecting a node set -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of sara.mitchell@xxxxxxxxx Sent: quinta-feira, 5 de Dezembro de 2002 23:43 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: XSL Help!! Chandra, you might want to look through the XSLT FAQ at http://www.dpawson.co.uk/. This along with some of the books suggested at the site can help a lot. But to answer your questions: > When u say <xsl:apply-templates select="NAME"/>, Will all the > NAME nodes > under MEMBER be selected(say there are more than 1 NAME nodes under > MEMBER)? yes (but only NAME children, not descendants that are an lower in the hierarchy) >Also will the NAME template rule be applied to each > one of the NAME > nodes before the Phone node is selected? yes > > 2) > <xsl:variable name='signers' select=/legal_authenticator/person'/> > <xsl:if test='$signers'> > ..... > ..... > </xsl:if> > > What is the xsl:if tag doing here? Is it testing whether > /legal_authenticator/person' exists?? yes > > 3)<person_name> > <nm> > <GIV V="Henry"/> > <FAM V="Levin"/> > </nm> > <person_name.type_cd V="L" S="2d"/> > </person_name> > > For the above xml, I see the following in the stylesheet > <xsl:apply-templates > select='person_name[person_name.type_cd/@V="L"]'/> > What do the [] mean?? Why can't I just have / instead of the []?? [] is what the XSLT spec calls a predicate. It's a way of specifying a criteria rather than pointing to a specific node. So, what this select is saying (in English) is: Select all person_name nodes from the current context that contain a person_name.type_cd element with a V attribute whose value is "L" But what is selected is the person_name node and that's what the XSLT engine looks for and how it selects the template to apply to person_name. If you had this instead: <xsl:apply-templates select='person_name/person_name.type_cd/@V="L"/> what the select would say would be: Select the V attribute on the person_name.type_cd element that is a child of a person_name element that is a child of the current context. It selects the attribute. Sara XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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
|