Subject: RE: [xsl] Template to return XML From: Jarno.Elovirta@xxxxxxxxx Date: Fri, 17 Oct 2003 10:51:26 +0300 |
Hi, > I need a template to return a subset of XML from the xml > source. I'm trying > to populate a variable with this information. How can I do this? > Example: > > <A> > <B> > <ASDF/> > <QWEA/> > <FEASI/> > </B> > <C/> > </A> > > > So, a template that will return (as an example) <B> and its > subset of data. > Something like > > <xsl:template name="get_subset_xml"> > .... select the <b> node > </xsl:template> If you want get_subset_xml to return the *source nodes*, that isn't possible with XSLT 1.0. You can create a copy of the nodes and return that as a RTF. > More importantly, how do I assign a variable to this new subset? > So: > > <xsl:variable name="some_subset" select="get_subset_xml"/> > > where $some_suset is: > <B> > <ASDF/> > <QWEA/> > <FEASI/> > </B> <xsl:variable name="some_subset" select="/A/descendant::*"/> but it's more than likely you want <xsl:variable name="some_subset" select="/A/B"/> as the former the variable is bound to a set of nodes B, ASDF, QWEA, and FEASI, whereas in the latter it's bound to just the B node and you can access the child nodes by normal tree navigation. Cheers, Jarno - Razed In Black: Disintegration (The Cure cover) XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Template to return XML, Karl J. Stubsjoen | Thread | RE: [xsl] Template to return XML, Passin, Tom |
Re: [xsl] Template to return XML, Mukul Gandhi | Date | RE: [xsl] generate XHTML header wit, Jarno . Elovirta |
Month |