Subject: RE: Conditional selection of Templates in XSL From: "Chris Bayes" <Chris@xxxxxxxxxxx> Date: Thu, 24 Aug 2000 22:27:08 +0100 |
Try <xsl:template match="TABLE"> <xsl:choose> <xsl:when test="$isFile = 'true'"> <xsl:call-template name="extractTable"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select="." /> </xsl:otherwise> </xsl:choose> <xsl:apply-templates/> </xsl:template> <xsl:template name="extractTable"> <xsl:value-of select="./text()"/> </xsl:template> Ciao Chris XML/XSL Portal http://www.bayes.co.uk/xml >-----Original Message----- >From: owner-xsl-list@xxxxxxxxxxxxxxxx >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of ciaran byrne >Sent: 25 August 2000 00:30 >To: XSL-List >Subject: Conditional selection of Templates in XSL > > >Hi all, > I'm attempting to select certain templates in my XSL >according to whether I've set a param to true or false. >Allow me to explain as follows: >In HTML tables can be nested. In my XML they can't. >So, I have a param set in my XSL that I pass a value into >using MSXML. If this value is set to 'true' then I want to >just extract the text from the table i.e. TABLE/text() >if it's false then I want to output the table and all the child >nodes that go with it. >Here is the type of XSL I'm attempting: > ><xsl:template match="TABLE"> > <xsl:choose> > <xsl:when test="$isFile = 'true'"> > <xsl:call-template name="extractTable"/> > </xsl:when> > <xsl:otherwise> > <!-- Here I want to output the Table with all > it's child nodes such as <tr>,<td> etc. --> > </xsl:otherwise> > </xsl:choose> > <xsl:apply-templates/> ></xsl:template> > ><!-- Does this mean that when called I only match against >the text node ????? --> ><xsl:template name="extractTable" match="TABLE/text()"> > <xsl:value-of select="."/> ></xsl:template> > >I know this is wrong...but I was hoping it would give an idea of where >I'm going. > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Conditional selection of Templates , ciaran byrne | Thread | Re: Conditional selection of Templa, Tony Graham |
RE: parse malformed XML element, Chris Bayes | Date | RE: XSLT design good practice, Antony Scott |
Month |