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

The Archive Base Latest Questions

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

I’m basically looking for the opposite of this An example of the XML I’m

  • 0

I’m basically looking for the opposite of this

An example of the XML I’m dealing with:

<profiledesc>
   <creation>
       Finding Aid encoded by Some Guy, <date normal="2011-09-21">21 September 2011</date>
   </creation>
   <langusage encodinganalog="546">
      Finding aid written in
      <language langcode="eng" scriptcode="latn" encodinganalog="041">
         English   
      </language>
   </langusage>
</profiledesc>

An example of the XSLT I’m writting (only the relevant parts):

<xsl:template priority="3" match="descgrp|eadheader|filedesc|titlestmt|profiledesc|archdesc|langusage|did">
   <xsl:apply-templates select="./child::node()"/>
</xsl:template>

<xsl:template priority="2" match="language">
   <atom name="EADLanguageOfFindingAid" type="text" size="short">
      <xsl:value-of select="."/>
   </atom>
   <atom name="EADLanguageCodeOfFindingAid" type="text" size="short">
       <xsl:value-of select="normalize-space(@langcode)"/>
   </atom>
</xsl:template>

... Other templates, for nodes like 'creation' ....

An example of the (bad) output I’m getting:

... Some other tags ...
<atom name="EADCreation" type="text" size="short">Finding Aid encoded by Some Guy, 21 September 2011</atom>
Finding aid written in
<atom name="EADLanguageOfFindingAid" type="text" size="short"> English </atom>
<atom name="EADLanguageCodeOfFindingAid" type="text" size="short">eng</atom>
... Some other tags ...

An example of the (good) output I want:

... Some other tags ...
<atom name="EADCreation" type="text" size="short">Finding Aid encoded by Some Guy, 21 September 2011</atom>
<atom name="EADLanguageOfFindingAid" type="text" size="short"> English </atom>
<atom name="EADLanguageCodeOfFindingAid" type="text" size="short">eng</atom>
... Some other tags ...

Note that in the second output the “Finding aid written in” line is missing.

So, as you can see, I designed templates to output just the “language” portion of the “langusage” tag, but the whole tag, including the “Finding aid written in” text node, is being output instead. I can’t be sure that the text node will exist or that it will be first (or last, or in any particular position). I also can’t be sure that there will only be one text node or one child node. So, I can’t make use of any solution that relies on simply choosing the “[xth]” node (child or text).

I’d appreciate any advice at this point, even some keywords that would help me find the solution via Google (I’ve had no luck there so far).

  • 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:51:20+00:00Added an answer on June 7, 2026 at 4:51 pm

    It sounds like you want to select only the child elements of langusage instead of all child nodes (of any type, which is what node() selects (excluding attribute nodes and the root node)).

    For example, this stylesheet:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="langusage">
            <xsl:apply-templates select="*"/>
        </xsl:template>
        <xsl:template match="language">
            <atom name="EADLanguageOfFindingAid" type="text" size="short">
                <xsl:value-of select="normalize-space()"/>
            </atom>
            <atom name="EADLanguageCodeOfFindingAid" type="text" size="short">
                <xsl:value-of select="normalize-space(@langcode)"/>
            </atom>
        </xsl:template>
    </xsl:stylesheet>
    

    Applied to this simplified input:

    <profiledesc>
       <langusage encodinganalog="546">
          Finding aid written in
          <language langcode="eng" scriptcode="latn" encodinganalog="041">
             English   
          </language>
          <language langcode="esp" scriptcode="latn" encodinganalog="042">
             Spanish   
          </language>
       </langusage>
    </profiledesc>
    

    Produces the following output:

    <atom name="EADLanguageOfFindingAid" type="text" size="short">English</atom>
    <atom name="EADLanguageCodeOfFindingAid" type="text" size="short">eng</atom>
    <atom name="EADLanguageOfFindingAid" type="text" size="short">Spanish</atom>
    <atom name="EADLanguageCodeOfFindingAid" type="text" size="short">esp</atom>
    

    The unwanted text — Finding aid written in — does not appear in the output.

    Note that the * in:

    <xsl:apply-templates select="*"/>
    

    …is just a shorter way to say child::*. Both select all element children of the current node.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.