Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] Passing Elements to templates...

From: Venkatasubbaiah Chenna <venkatasubbaiah.c@------------------->
To:
Date: 6/3/2002 11:09:00 AM
I have a doubt, how can i increment a variable in an if condition?

-----Original Message-----
From: Mike Brown [mailto:mike@xxxxxxxx]
Sent: Tuesday, June 04, 2002 12:19 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Passing Elements to templates...


CROFT, MICHAEL wrote:
> Is there a way to pass an entire element, with all its children to a
> template.  Then, within that template which it was passed to, specifically
> extract certain elements to display the text?

You can pass an object of any type, including node-set, to a template as a
parameter. If passing a node-set, it is usually the case that you pass just
the one element node; you can use XPath expressions to obtain its
descendants
and attributes. 

  <xsl:template match="foo">
    <xsl:apply-templates select="path/to/some/coolNodes">
      <xsl:with-param name="aNodeSet" select="some/foo/descendant"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="coolNodes">
    <xsl:param name="aNodeSet" select="/.."/> <!-- default: empty set -->
    <xsl:text>&#10;number of nodes in aNodeSet: </xsl:text>
    <xsl:value-of select="count($aNodeSet)"/>
    <xsl:text>&#10;number of child elements of all of those nodes:
</xsl:text>
    <xsl:value-of select="count($aNodeSet/*)"/>
  </xsl:template>

Is there a particular problem you are having?

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
*********************************************************************
Disclaimer: The information in this e-mail and any attachments is
confidential / privileged. It is intended solely for the addressee or
addressees. If you are not the addressee indicated in this message, you may
not copy or deliver this message to anyone. In such case, you should destroy
this message and kindly notify the sender by reply email. Please advise
immediately if you or your employer does not consent to Internet email for
messages of this kind.
*********************************************************************

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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent