Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:28:50+00:00 2026-06-04T05:28:50+00:00

I am wondering if you can access the result-document during processing. The reason I

  • 0

I am wondering if you can access the result-document during processing.

The reason I ask is that I am transforming an input document and would like to insert elements depending on some conditions but this would have to occur when I have traversed the tree and I am nearly at end of creating it.

The transformed xml looks something similar to this:

<xform>
    <xforms>
        <model>
            <instance>
                <data />
                <data />
            </instance>
        </model>
        <bind />
        <bind />
        <bind />
    </xforms>
</xform>

I intend, during transformation (before the above xml is serialized), to access the <instance> tag and insert additional <data> elements.

Note
The input document is different from the above xml – the above xml is what the transformation should produce.

Similarly, I would want to access the <xform> element and insert additional <bind> nodes.

So the final document would look like this (assuming I added 2 data nodes and 2 bind nodes):

<xform>
    <xforms>
        <model>
            <instance>
                <data />
                <data />
                <data>new data node</data>
                <data>second new data node</data>
            </instance>
        </model>
        <bind />
        <bind />
        <bind />
        <bind>new bind node</bind>
        <bind>second new bind node</bind>
    </xforms>
</xform>

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:28:51+00:00Added an answer on June 4, 2026 at 5:28 am

    No, you can’t access a result-document, you can however create temporary trees in variables and then process them again, if needed with templates with a different mode. So instead of e.g.

    <xsl:template match="/">
      <xsl:result-document href="example.xml">
    <xform>
     <xforms>
      <model>
       <instance>
        <data>
        </data>
       </instance>
      </model>
      <bind />
      <bind />
      <bind />
     </xforms>
    </xform>
      </xsl:result-document>
    </xsl:template>
    

    you would create the first result in a variable and then process it further as in e.g.

    <xsl:template match="@* | node()">
      <xsl:copy>
        <xsl:apply-templates select="@* | node()"/>
      </xsl:copy>
    </xsl:template>
    
    <xsl:template match="/">
      <xsl:variable name="temp1">
    <xform>
     <xforms>
      <model>
       <instance>
        <data>
        </data>
       </instance>
      </model>
      <bind />
      <bind />
      <bind />
     </xforms>
    </xform>
    </xsl:variable>
      <xsl:result-document href="example.xml">
        <xsl:apply-templates select="$temp1/*"/>
      </xsl:result-document>
    </xsl:template>
    
    <xsl:template match="instance">
      <xsl:copy>
        <xsl:apply-templates/>
        <data>...</data>
      </xsl:copy>
    </xsl:template>
    

    That sample does not use modes but I often use them with variables and different processing steps to cleanly seperate the templates for each step from other steps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering how I can access the keyboard list that you normally access
I am wondering what can be the maximum value that a <input type=hidden> can
I'm wondering how can I write a function: 'a list*int -> 'a list*list that
I now have my Windows Azure environment set up so that I can access
Just wondering how people would go about this. Say I have one class that
I was wondering if I can access the webcam via a browser plugin e.g.
Hey I was wondering how I can access the front facing camera. Maybe there's
I have a query that is returning a single result and I'm wondering if
I'm wondering how can I access an IEnumerable of all the elements in a
I was wondering how can I list the user tables name with its primary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.