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 8229749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:54:17+00:00 2026-06-07T16:54:17+00:00

I have two functions that are outputting XML data. Ideally I’d like to combine

  • 0

I have two functions that are outputting XML data. Ideally I’d like to combine the outputs of each function into one variable to parse data.

In SQL terms, each function can be joined together by an inner join via the attribute PageId… but joins are not permitted in XSLT (or at least to my knowledge).

Any suggestions on the cleanest/easiest way to combine these functions? The functions I’m calling are built into the cms and cannot be edited.

Some more information:

The first function is the sitemap. It lists the webpage ids and their levels for the website.

The second function pulls webpage ids and their metadata tags that I need combined with the site map.

I thought about creating variables for the second function Page Ids, but the number of pages with the metadata tags changes and I don’t believe the variables support dynamic names.

I apologize if I’m not being clear enough as xslt is new to me. Please let me know if more information is needed.

edit: adding code example

<in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
  <in:result name="SitemapXml">
    <Page Id="a0a47ce1-6eba-4d29-a7a3-3749c768c7e7" isopen="true" xmlns="">
      <Page Id="a3055286-0e90-4b04-99dd-fb1a61dde0bf" isopen='true' xmlns="">
        <Page Id="da675b13-d4d3-42ab-acc1-82e2a5408100" isopen='true' iscurrent='true' Depth="2"/>
      </Page>
    </Page>
  </in:result>
  <in:result name="GetisrootXml">
    <isroot PageId="a0a47ce1-6eba-4d29-a7a3-3749c768c7e7" Id="f8d4eea4-7070-4bc3-a804-e106697ffaa9" isroot="true" xmlns=""/>
    <isroot PageId="f8e4adbc-2758-42d6-bc40-0192ba0107a6" Id="db62e132-3f3b-493f-917a-9e090f887f13" isroot="false" xmlns=""/>
  </in:result>
</in:inputs>

What I would like returned:

<in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
  <in:result name="SitemapXml">
    <Page Id="a0a47ce1-6eba-4d29-a7a3-3749c768c7e7" isopen="true" xmlns="" isroot='true'>
    </Page>
    <Page Id="a3055286-0e90-4b04-99dd-fb1a61dde0bf" isopen='true' xmlns="">
        <Page Id="da675b13-d4d3-42ab-acc1-82e2a5408100" isopen='true' iscurrent='true' Depth="2"/>
  </in:result>
</in:inputs>

From this, I want to further change the output to fit my needs (add tags for display purposes). In order to get to that point, the isroot attribute needs to be attached to the sitemap.

  • 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-07T16:54:18+00:00Added an answer on June 7, 2026 at 4:54 pm

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:key name="kIsRootByPageId" match="isroot" use="@PageId"/>
    
     <xsl:template match="node()|@*">
         <xsl:copy>
           <xsl:apply-templates select="node()|@*"/>
         </xsl:copy>
     </xsl:template>
    
     <xsl:template match="in:result[1]/Page">
      <xsl:copy>
       <xsl:apply-templates select="@*"/>
       <xsl:copy-of select="key('kIsRootByPageId',@Id )/@isroot"/>
       <xsl:apply-templates select="node()"/>
      </xsl:copy>
     </xsl:template>
    
     <xsl:template match="in:result[2]"/>
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
        <in:result name="SitemapXml">
            <Page Id="a0a47ce1-6eba-4d29-a7a3-3749c768c7e7" isopen="true" xmlns=""></Page>
            <Page Id="a3055286-0e90-4b04-99dd-fb1a61dde0bf" isopen='true' xmlns="">
                <Page Id="da675b13-d4d3-42ab-acc1-82e2a5408100" isopen='true' iscurrent='true' Depth="2"/></Page>
        </in:result>
        <in:result name="GetisrootXml">
            <isroot PageId="a0a47ce1-6eba-4d29-a7a3-3749c768c7e7" Id="f8d4eea4-7070-4bc3-a804-e106697ffaa9" isroot="true" xmlns=""/>
            <isroot PageId="f8e4adbc-2758-42d6-bc40-0192ba0107a6" Id="db62e132-3f3b-493f-917a-9e090f887f13" isroot="false" xmlns=""/>
        </in:result>
    </in:inputs>
    

    produces the wanted, correct result:

    <in:inputs xmlns:in="http://www.composite.net/ns/transformation/input/1.0">
       <in:result name="SitemapXml">
          <Page Id="a0a47ce1-6eba-4d29-a7a3-3749c768c7e7" isopen="true" isroot="true"/>
          <Page Id="a3055286-0e90-4b04-99dd-fb1a61dde0bf" isopen="true">
             <Page Id="da675b13-d4d3-42ab-acc1-82e2a5408100" isopen="true" iscurrent="true"
                   Depth="2"/>
          </Page>
       </in:result>
    </in:inputs>
    

    Explanation:

    1. The identity rule copies “as-is” every node for which this template is selected for execution.

    2. There are two overriding templates, the second of which “deletes” with its empty body the second occurence of in:result.

    3. The first overriding template matches any Page that is a child of the first occurence of in:result. We use keys to efficiently and conveniently find the isroot element that references the current Page in its PageId attribute — and we copy its isroot attribute.

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

Sidebar

Related Questions

I have two functions here say animation1 and load1 they work like that: function
I have two similar functions that I would like to combine so that I
Say I have two functions that expect ...rest parameters private function a(...myParams):void { trace(myParams.length);
I have two fields that I'd like to match. (already done the validation functions
I have two functions that are very similar and i'd like to make a
I have two resize functions that I would like to perform one after the
I have two Jquery functions that each work independently on a sharepoint page -
I have two functions that return simple strings. Both are registered. $.views.helpers({ parseDate: function
I have two functions that i'm hoping i can put into one and can
I have two functions that have different enough logic but pretty much the same

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.