Re: xsl:template - matching template with the name which is
srirangababu thimmaiah wrote: > I have a ? regarding using of "apply-templates > match="name" > > can "name" be anything, that means, it is not an > element of XML. No, the value of the match attribute must be what is defined in the XSLT spec as a pattern. Basically, you have a node, and you ask, "does this node match this pattern?" See http://www.w3.org/TR/xslt#patterns for details about patterns. You probably need to also read about the processing model used by XSLT. Go to the URL above and scroll up a little. xsl:apply-templates identifies a set of nodes from the source tree (derived from your XML) to process. xsl:template match="..." declares that the template can be used to process nodes that match the pattern in the match attribute. the XSLT processor will follow certain rules to determine which template is the best match for a given node, and will use that template. > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/TR/WD-xsl"> This in your stylesheet indicates you are using the old MSXML. Please, please, please read the MSXML FAQ at http://www.netcrucible.com/xslt/msxml-faq.htm because until you upgrade, you are *not* using an XSLT processor, and things that people suggest here will not work. > 1.when the xsl transformer checks for the root node, > then it looks in the stylesheet > for the match for root, if there it does the process > inside template. Essentially, yes. There is supposed to be a built-in template for the root node, so there will never be a situation where there is no match. > 2.can i say apply-templates select="CHECK" as in line > *. > Note: CHECK is not in the xml document so will not > be in the dom tree. Yes, you can say "go process CHECK element children of the current node" and if there are no such nodes, nothing will happen. > but can i just create a template for CHECK which is > not in dom tree and call that, will it be called > when coded as i have coded. No, it will not. You want named templates, a feature not supported by the version of MSXML you are using. - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://www.skew.org/xml/ 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