[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: where to put the filter?

Subject: Re: where to put the filter?
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Wed, 04 Oct 2000 14:04:14 -0400
how to put the filter
At 10:43 AM 10/04/2000 -0500, Keith wrote:
...When I call the transformXML() function after the alerts the page comes back blank. I am placing this strFilter in the <filter></filter> tags when the SOAP request is sent. I am sure it's because I am placing the
<xsl:apply-templates select="filter"/>, <xsl:template match
select="filter">,<xsl:value-of select="filter"> in the wrong place. I can't
find any documentation on this at all. They all give the syntax for
building a filter, but not on where to place it.

Not sure if this will help or not....


An xsl:template is always a top-level element, i.e. a child of the xsl:stylesheet element. xsl:apply-templates sends the XSLT processor off on a hunt for template rules (explicit or built-in) for children of the context node established by the <xsl:template match="..."> pattern; assuming it finds any such template rules, the processor handles them at that point in the containing template. xsl:value-of inserts *content* from the source doc into a template, so it too is a descendant of xsl:template.

So given a source document like this:

  <rootelem title="MyRoot">
    <childelem>child1</childelem>
    <childelem>child2<grandchildelem>grandkid</grandchildelem></childelem>
  </rootelem>

you might have a template rule like this:

  <xsl:template match="/rootelem">
    <newrootelem>
      <xsl:value-of select="@title"/>
      <xsl:apply-templates />
    </newrootelem>
  </xsl:template>

See? xsl:template contains both xsl:value-of and xsl:apply-templates. The result tree will contain:

  <newrootelem>
    MyRoot
    child1 child2 grandkid
  </newrootelem>

[Now comes the part where Evan jumps in and qualifies all the above. :)]

==========================================================
John E. Simpson | "Curiosity killed the cat,
http://www.flixml.org | but for a while I was a
XML Q&A: http://www.xml.com | suspect." (Steven Wright)



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.