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

Re: XSL and XML Help

Subject: Re: XSL and XML Help
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Mon, 16 Oct 2006 19:30:43 +0200 (CEST)
xml help
Wendell Piez wrote:

  Hi

> At 06:00 PM 10/13/2006, Dr KM wrote:

> > > You can do this with a for-each instruction, but
> > > anything you can do with a for-each instruction you
> > > can do with templates

> >   Excepted that template rules are applicable (mmh, not
> > sure this is correct English) only to nodes.

> This is interesting ... it's true in XSLT 2.0, but not in
> XSLT 1.0, where one can select only nodes when executing a
> for-each.

  Yes.

> In XSLT 1.0, indeed, the content of a for-each instruction
> is formally called a "template", while what we commonly
> call a "template" is actually named a "template rule"
> (which usage I see you observe :-).

  Yes, there were a lot of confusion between "template" and
"template rule".  So XSLT 2.0 replaced "template" by
"sequence constructor".  But in your initial sentence above,
I guess you meant "template rule", isn't it ?-)

> I suppose this is also not the case in XSLT 2.0?

  Mmh, I'm not sure what you mean here?

  A simple example for for-each vs/ apply-templates in XSLT
2.0.  It is not "right" (for one definition of "right") to
write:

    <xsl:function name="my:f">
      <xsl:param name="p" as="item()+"/>
      <xsl:apply-templates select="$p"/>
    </xsl:function>

Write instead:

    <xsl:function name="my:f">
      <xsl:param name="p" as="item()+"/>
      <xsl:for-each select="$p">
        ...
      </xsl:for-each>
    </xsl:function>

or:

    <xsl:function name="my:f">
      <xsl:param name="p" as="node()+"/>
      <xsl:apply-templates select="$p"/>
    </xsl:function>

or even:

    <xsl:function name="my:f">
      <xsl:param name="p" as="item()+"/>
      <xsl:sequence select="for $i in $p return ..."/>
    </xsl:function>

  But I agree for-each is often over-employed, instead of
template rules.

  Regards,

--drkm



















	

	
		
___________________________________________________________________________ 
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions ! 
Demandez ` ceux qui savent sur Yahoo! Questions/Riponses
http://fr.answers.yahoo.com

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.