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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:07:34+00:00 2026-05-26T11:07:34+00:00

[XSLT stylesheet] In the example below, <tag1> <tag2> … <generatoritem id=name1> <tag5> … <tag6>

  • 0

[XSLT stylesheet]

In the example below,

<tag1>
    <tag2>
        ...
            <generatoritem id="name1">
                <tag5>
                ...
                    <tag6>
                        <name>Center</name>
                        <keyframe>
                            <when>frame1</when>
                            <value>
                                <horiz>100</horiz>
                                <vert>100</vert>
                            </value>
                        </keyframe>
                        <keyframe>
                            <when>frame2</when>
                            <value>
                                <horiz>150</horiz>
                                <vert>150</vert>
                            </value>
                        </keyframe>
                    </tag6>
                </tag5>
            </generatoritem>
            <generatoritem id="name2">
                <tag7>
                ...
                    <tag8>
                        <name>Center</name>
                        <keyframe>
                            <when>frame3</when>
                            <value>
                                <horiz>100</horiz>
                                <vert>100</vert>
                            </value>
                        </keyframe>
                        <keyframe>
                            <when>frame4</when>
                            <value>
                                <horiz>150</horiz>
                                <vert>150</vert>
                            </value>
                        </keyframe>
                    </tag8>
                </tag7>
            </generatoritem>
    </tag2>
</tag1>

eliminating the excess of nodes, we’re trying to obtain the following output format:

id='name1'
    instance='frame1'
        horiz='100'
        vert='100'
    instance='frame2'
        horiz='150'
        vert='150'

id='name2'
    instance='frame3'
        horiz='200'
        vert='200'
    instance='frame4'
        horiz='250'
        vert='250'  

So, based on multiple id values, we work on specific nodes. Tags has to be eliminated and just the critical information retained.

Please advise. Thanks!

  • 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-05-26T11:07:35+00:00Added an answer on May 26, 2026 at 11:07 am
        <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                                        xmlns:exslt="http://exslt.org/common">
        <!-- disable xml output -->
        <xsl:output method="text"/>
    
        <xsl:variable name="toprocess">
        <data>
            <node>name1</node>
            <node>name3</node> <!-- and other nodes you want to process -->
        </data>
        </xsl:variable>
    
        <xsl:template match="/">
            <xsl:apply-templates select=".//generatoritem[ @id = exslt:node-set($toprocess)/data/node]"/>
        </xsl:template>
    
        <xsl:template match="generatoritem">
        id=<xsl:value-of select="@id"/>
        <xsl:apply-templates select=".//keyframe"/>
        <!-- just for the new line -->
        <xsl:text>
        </xsl:text>
        </xsl:template>
    
        <xsl:template match="keyframe">
             instance='<xsl:value-of select="when"/>'
                     horiz='<xsl:value-of select="value/horiz"/>'
                     vert='<xsl:value-of select="value/vert"/>
        </xsl:template>
    
        </xsl:stylesheet>
    

    should give you as output

    xsltproc data.xsl data.xml

    id='name1'
       instance='frame1'
           horiz='100'
           vert='100'
       instance='frame2'
           horiz='150'
           vert='150'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xslt stylesheet with multiple xsl:import s and I want to merge
I'm applying an XSLT stylesheet to the following XML file: <top xmlns=http://www.foo.com/bar> <elementA />
I have an XSLT stylesheet that transforms an XML file to JSON format and
In a xslt-stylesheet I'm using the methods exsl:node-set and set:distinct to access and filter
I want to apply an XSLT Stylesheet to an XML Document using C# and
I want to attach an xslt stylesheet to an XML document that I build
I am trying to develop an XSLT stylesheet which will transform an xml into
I've got to edit an XSLT stylesheet, but I'm flying blind because the XML
Lets say I have a xslt stylesheet like the following: <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet
I have a Java servlet which generates XML, translates it with an XSLT stylesheet,

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.