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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:37:02+00:00 2026-05-16T02:37:02+00:00

I have XSLT 1.0 code like this: <xsl:key name=enemyItems match=metadata[attributes/metadata_key/@value = ‘enemylist’] use=attributes/metadata_refkey/@value/> <xsl:template

  • 0

I have XSLT 1.0 code like this:

<xsl:key name="enemyItems"
         match="metadata[attributes/metadata_key/@value = 'enemylist']"
         use="attributes/metadata_refkey/@value"/>

<xsl:template match="item">
    <xsl:variable name="enemyList"
                  select="key('enemyItems', @key)/attributes/@value"/>
    <xsl:if test="string-length($enemyList) > 0">
        <xsl:value-of select="@name"/>
    </xsl:if>
</xsl:template>

As I understand it, a key can store more than one value for a particular element. I believe the code above is only getting the first value when referring to key('enemyItems', @key).

So, I want to wrap that code in an xsl:for-each, like this

    <xsl:template match="item">
        <xsl:for-each select="key('enemyItems', @key)">
            <xsl:variable name="enemyList"
                      select="???/attributes/@value"/>
            <xsl:if test="string-length($enemyList) > 0">
                <xsl:value-of select="@name"/>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>

My question is: What goes in the ??? part? (That is, what is the name of the iteration variable or thing?)

  • 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-16T02:37:02+00:00Added an answer on May 16, 2026 at 2:37 am

    Inside an xsl:for-each tag, the context on each iteration is the node being examined. Thus the ??? in your question should be replaced with .

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

Sidebar

Related Questions

I have XSLT 1.0 like this: <?xml version=1.0?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0> <xsl:template match=paragraph> <p>
I have some XSLT code like following <xsl:choose> <xsl:when test=v:Values = 'true'> <xsl:text>A</xsl:text> </xsl:when>
I have this XSLT 2.0: <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output indent=yes/> <xsl:strip-space elements=*/> <xsl:template match=node()|@*>
I have used the following code in my XSL: <xsl:variable name=link select=normalize-space(concat('#',$chapter2))/> <a href={$link}>Next
I have the following in my xslt file: <xsl:param name=predicate select=//Event /> <xsl:apply-templates select=$predicate
I have a chained XSLT 2.0 transformation scenario (using saxon), like this: - I1.xml
I have written a C# code for triggering an XML to XML (XSLT) transformation.
I have an XSLT transform issue: style=width:{Data/PercentSpaceUsed}%; And the value of Data/PercentSpaceUsed is integer
I have the following XML: <assessment> <section> <item> <attributes> <variables> <variable> <variable_name value=MORTIMER/> </variable>
Essentially, I have XML structured like this: <A> <B> <1>data</1> <2>data</2> <C> <1>data</1> <2>data</2>

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.