style sheet referencing itself?

Discussion in 'XML' started by Joseph Kesselman, Mar 20, 2008.

  1. Joseph Kesselman, Mar 20, 2008
    #1
    1. Advertising

  2. Hello

    Is is possible for an xsl style sheet to reference itself? I see examples
    of using document() to get a set of nodes from an external xml file, but
    in my setting I don't load any files, I just have variables in memory that
    contain the xml data.

    I want the style sheet to say something like

    <xsl:template match="certain-nodes-in-document" >
    <xsl:for-each select="a-set-of-nodes-in-the-template">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:for-each>
    </xsl:template>

    Thanks for feedback.
    Malcolm
    Malcolm Dew-Jones, Mar 20, 2008
    #2
    1. Advertising

  3. Joseph Kesselman () wrote:
    : Malcolm Dew-Jones wrote:
    : > Is is possible for an xsl style sheet to reference itself?

    : document(""). See http://www.w3.org/TR/xslt#function-document

    Thanks, I was looking at the xpath docs to try to figure out what to pass
    to the document function, but I hadn't properly appreciated the usage of
    the document function itself.

    Much clearer now thanks.
    Malcolm Dew-Jones, Mar 20, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc Nederhoff

    Adding style sheet dynamicaly

    Marc Nederhoff, Nov 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    411
    charles
    Nov 5, 2003
  2. Jim Heavey

    Cascading Style Sheet

    Jim Heavey, Nov 18, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    361
    Justin Musick
    Nov 19, 2003
  3. David C

    referencing to style sheet

    David C, Feb 5, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    5,013
    Josh Twist
    Feb 6, 2006
  4. Replies:
    0
    Views:
    505
  5. Ken Varn
    Replies:
    0
    Views:
    424
    Ken Varn
    Apr 26, 2004
Loading...

Share This Page