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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:02:23+00:00 2026-06-12T03:02:23+00:00

I trying transform (in eclipse) a document below: <doc> <city name=Paris country=France /> <city

  • 0

I trying transform (in eclipse) a document below:

<doc>
   <city name="Paris"
         country="France" />
   <city name="Madrid"
         country="Spain" />
   <city name="Vienna"
         country="Austria" />
   <city name="Barcelona"
         country="Spain" />
   <city name="Salzburg"
         country="Austria" />
   <city name="Bonn"
         country="Germany" />
   <city name="Lyon"
         country="France" />
   <city name="Hannover"
         country="Germany" />
   <city name="Calais"
         country="France" />
   <city name="Berlin"
         country="Germany" />
</doc>

with xslt:

<xsl:template match="/">
   <out>
      <all-countries>
            <xsl:copy-of select="//city" />
      </all-countries>
      <distinct-countries>
            <xsl:copy-of select="set:distinct(//@country/..)" />
      </distinct-countries>
   </out>
</xsl:template>

I’m use Xalan 2.7.1 it’s work fine, but when I’m use ‘JRE Instance Default’ processor I get error:

16:07:20,642 ERROR [main] Main  - java.lang.RuntimeException: Run-time internal error in 'HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. '
  • 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-12T03:02:24+00:00Added an answer on June 12, 2026 at 3:02 am

    This is guessing, but perhaps you can try other ways of getting the distinct values. Here are two suggestions, both of which are XSLT2.0 solutions:

    <distinct-countries>
        <xsl:copy-of select="distinct-values(//@country)" /> 
    </distinct-countries>
    
    <xsl:for-each-group select="//city" group-by="@country">
      <xsl:value-of select="current-grouping-key()" />
    </xsl:for-each-group>
    

    If you are using XSLT1.0, the way to do this without using an extension function, it to make use of a technique called Muenchian Grouping. Firstly define a key to ‘group’ city elements by their country attribute.

    <xsl:key name="countries" match="city" use="@country" />
    

    Then you can pick out the distinct countries, by selecting the first city elements that occur in each group.

    <distinct-countries> 
       <xsl:for-each select="//city[generate-id() = generate-id(key('countries', @country)[1])]"> 
          <xsl:value-of select="@country" />
       </xsl:for-each>
    </distinct-countries> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an XSLT to transform an XML document and having
Im trying to transform an XML document into XHTML using XSL transformation and was
I'm trying to transform the following XML.. <?xml version=1.0 encoding=utf-16?><Member TextRank=unknown FullName=My Name ..etc..
I am new to XSLT I am trying to transform a name value pair
I am new to XSLT I am trying to transform a name value pair
I'm trying to transform an XML document into another XML document. I've tried various
I am trying to transform a moving animated sprite to be a reverse of
I'm trying to transform one XML format to another using XSL. Try as I
I am trying to transform my data.frame by calculating the log-differences of each column
I am trying to transform an XML file into an updated version. I have

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.