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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:26:23+00:00 2026-06-14T22:26:23+00:00

ORIGINAL – this is my original XML: <course acad_year=2012 cat_num=85749 offered=N next_year_offered=2013> <term term_pattern_code=4

  • 0

ORIGINAL – this is my original XML:

<course acad_year="2012" cat_num="85749" offered="N" next_year_offered="2013">
  <term term_pattern_code="4" fall_term="Y" spring_term="Y">full year</term>
  <department code="VES">
    <dept_long_name>Department of Visual and Environmental Studies</dept_long_name>
    <dept_short_name>Visual and Environmental Studies</dept_short_name>
  </department>
</course>

DESIRED RESULT – I am trying to create another shorter version of the original XML that will group and list all department codes like in the example below:

   <departments>
      <department code="some_code" name="some_name"/>
      <department code="some_code" name="some_name"/>
      <department code="some_code" name="some_name"/>
   </departments>

This is what I am trying and not working:

   <xsl:template match="/">
       <departments>
          <xsl:for-each-group select="fas_courses/course" group-by="department[@code]">
            <xsl:text disable-output-escaping="yes"> <department code=" </xsl:text>
            <xsl:value-of select="department/@code"/>
            <xsl:text>" name="</xsl:text>
            <xsl:value-of select="dept_short_name"/>
            <xsl:text disable-output-escaping="yes">"><department/></xsl:text>
         </xsl:for-each-group> 
       </departments>
   </xsl:template>

The error I am getting
F [Saxon-PE 9.4.0.3] The value of attribute “code” associated with an element type “department” must not contain the ‘<‘ character.

From the error message, I understand the ‘<‘ character is giving me an error inside of the xsl:text element, but how do I put that character then?, I am already using disable-output-escaping=”yes”, is there anything else???
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-06-14T22:26:24+00:00Added an answer on June 14, 2026 at 10:26 pm

    Using disable-output-escaping is never a good idea, and you really don’t need it here. Try this:

    <xsl:template match="/">
      <departments>
        <xsl:for-each-group select="fas_courses/course" group-by="department/@code">
          <department code="{department/@code}" name="{department/dept_short_name}" />
        </xsl:for-each-group> 
      </departments>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[Original] I have a ListBox which has its ItemsSource (this is done in the
// Original // I want to call this guy -(void)addFavorite:(NSString *)favoriteToAdd at, @selector here
Original Question: This is my first post ever. I'm trying to learn ios programming
Original format: <a href=http://www.example.com/t434234.html ...> 1. I need to fetch all URLs of this
Original post: Why doesn't this simple script work? if ($('#navigation > ul > li
The original use case: This is a possible use case I'm trying to solve:
Original question: this bit of javascript code will convert centimeters to feet. But the
Original source: http://twitter.com/tobeytailor/status/8998006366 (x=[].reverse)() === window // true I've noticed that this behavior affects
Original Question This is the Git repository that I have at the moment, which
Original question: This method is supposed to change the image being displayed on a

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.