Subject: Re: [xsl] XSLT2 processing question From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 23 May 2006 17:41:17 +0100 |
> What am I doing wrong? I thought the stylesheet would do the > following: Go to the root element (match="/"), No. / never matches an element it is the root node (in XPath 1) or teh document node (new name for same thing in XPath 2) which is the parent of the top level element (and also teh parent of top level comments and processing instructions. > generate my root ("adress") In XSLT1 you can not explictly create a root node, it is created implictly when you insert a top level element (or text or comment or processing instruction) into teh result tree. XSLT2 does have an explict xsl:document instruction to generate document nodes when needed (which is not very often). > The next template searches for the node "name" > everyware in the source ("//name"), The existence of a template never causes anything to be searched, that is controlled by eth select attribute on apply-templates. The match attribute just says that this template is to be invoked if the nodes that are selected match. (Starting a match with // does not change the nodes matched in XSLT1, it just changes the default priority). As others have said the result you get is because of the default template for elements, and the fact that the default select attribute on apply-templates is select="node()" ie select all children. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT2 processing question, andrew welch | Thread | RE: [xsl] XSLT2 processing question, Florent Georges |
[xsl] Re: WordML Question and norma, Jordan Soet | Date | Re: [xsl] XSLT2 processing question, Jagdishwar B |
Month |