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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:50:43+00:00 2026-05-23T06:50:43+00:00

I am new to XSLT, please help. We have an XML which we want

  • 0

I am new to XSLT, please help.
We have an XML which we want to convert it into Ruby ActiveResource format XML. Please help me with the XSLT code. Thank you.

XML INPUT

<PARM>
<PC>0</PC>
<PMT NM="THEME" DN="THEME" IR="0" T="0">
    <PV V="fast" L="" H="" C="4"/>
</PMT>
<PMT NM="INGREDIENTS" DN="INGREDIENTS" IR="0" T="0">
    <PV V="chicken" L="" H="" C="5"/>
    <PV V="tomato" L="" H="" C="12"/>
</PMT>
</PARM>

REQUIRED XML OUTPUT

<facet-groups type="array">
 <facet-group>
  <name>THEME</name>
  <facets type="array">
    <facet>
      <name>fast</name>
      <count>4</count>
    </facet>
  </facets>
 </facet-group>
 <facet-group>
  <name>INGREDIENTS</name>
  <facets type="array">
    <facet>
      <name>chicken</name>
      <count>5</count>
    </facet>
    <facet>
      <name>tomato</name>
      <count>12</count>
    </facet>
  </facets>
 </facet-group>
</facet-groups>

Please help. Thank you.

  • 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-23T06:50:43+00:00Added an answer on May 23, 2026 at 6:50 am

    This is the @LarsH in other words:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:strip-space elements="*"/>
        <xsl:output indent="yes"/>
    
        <xsl:template match="PARM">
            <facet-groups type="array">
                <xsl:apply-templates select="PMT"/>
            </facet-groups>
        </xsl:template>
    
        <xsl:template match="PMT">
            <facet-group>
                <name><xsl:value-of select="@NM"/></name>
                <facets type="array">
                    <xsl:apply-templates select="PV"/>
                </facets>
            </facet-group>
        </xsl:template>
    
        <xsl:template match="PV">
            <facet>
                <name><xsl:value-of select="@V"/></name>
                <count><xsl:value-of select="@C"/></count>
            </facet>
        </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a XSLT which will split large xml file into multiple xml file
I want to convert one xml file into another xml file using xslt.here, i
i am pretty new to XSLT / XML and HTML. I have a XML
Can any one help in transforming my xml though XSLT. I am new to
I have an xml being returned by an extension method. Can some please help
I am new to XSLT working on XML to XML transformation. I want to
I am new to XSLT and working on converting one format of XML to
new on ruby and using windows xp and rails 3, i want to send
New to Regex. I want to validate to this format: Any character allowed, except
I am new in xslt. I have the following problem. I need within an

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.