[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: <xsl:copy-of> question
Ray Waldin pointed out off-list, and quite rightly, that my previous response was incorrect: >"Christopher R. Maden" wrote: >> [Nikolai Grigoriev] >> ><!-- Processing of salary nodes is disabled for FullSecurity="0" --> >> ><xsl:template match="salary[/employee/@FullSecurity=0]"/> >> >> Not quite - that will hide all salaries in any document in which there is >> any employee with FullSecurity="0". You need to scope it: > ^^^ > >I think you meant to say: that will hide all salaries in any document in >which the >*document element* is an employee with FullSecurity="0". > >> <xsl:template match="employee[@FullSecurity=0]/salary"/> >> >> or, alternately: >> >> <xsl:template match="salary[../employee/@FullSecurity=0]"/> >> >> though I prefer the former for clarity. > >So do I as the latter is incorrect. It matches salary elements with >*sibling* employee >elements having FullSecurity="0". From the XPath REC: > >> a location step of .. is short for parent::node(). For example, ../title >>is short for >> parent::node()/child::title and so will select the title children of the >>parent of the >> context node. > >Parent employee elements are matched like this: > ><xsl:template match="salary[parent::employee/@FullSecurity=0]"/> > >or > ><xsl:template match="salary[..[name()='employee']/@FullSecurity=0]"/> > >though I prefer the former for clarity. :) > >-Ray -Chris -- Christopher R. Maden, Solutions Architect Exemplary Technologies One Embarcadero Center, Ste. 2405 San Francisco, CA 94111 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
|