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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:18:14+00:00 2026-05-30T01:18:14+00:00

How do I use apply-templates to select only those elements by name (not value)

  • 0

How do I use apply-templates to select only those elements by name (not value) that end with a specific pattern? Assume the following xml…

<report>
  <report_item>
    <report_created_on/>
    <report_cross_ref/>
    <monthly_adj/>
    <quarterly_adj/>
    <ytd_adj/>
  </report_item>
  <report_item>
   ....
  </report_item>
</report>

I want to use <xsl:apply-templates> on all instances of <report_item> where descendant elements end with ‘adj`, so, in this case, only monthly_adj, quaterly_adj, and ytd_adj would be selected and applied with the template.

<xsl:template match="report">
   <xsl:apply-templates select="report_item/(elements ending with 'adj')"/>
</xsl:template>
  • 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-30T01:18:16+00:00Added an answer on May 30, 2026 at 1:18 am

    I don’t think that regular expression syntax is available in this context, even in XSLT 2.0. But you don’t need it in this case.

    <xsl:apply-templates select="report_item/*[ends-with(name(), 'adj')]"/>
    

    * matches any node

    [pred] performs a node test against the selector (in this case *) (where pred is a predicate evaluated in the context of the selected node)

    name() returns the element’s tag name (should be equivalent to local-name for this purpose).

    ends-with() is a built-in XPath string function.

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

Sidebar

Related Questions

When I use apply-templates and select a variable sequence, does the template act upon
I'm starting to use XSLT, and I don't understand this line: <xsl:apply-templates select=file:file/file:description />
In a feedburner RSS I use <xsl:template match=node() | @*> <xsl:copy> <xsl:apply-templates select=node() |
<xsl:apply-templates mode=block2sequence select=NewDataSet/Table[CTD_CTD_PKG_ID =$PackageId][position()=1] and NewDataSet/Table[CTD_SEQ_NUM =$strXSLMsgType][position()=1]/> why cant i use two conditions in
Below I'm trying to match certain nodes. <xsl:template match=nodes> <element> <xsl:apply-templates select=nodes mode=different />
<xsl:template match=o:CustomDocumentProperties> <xsl:copy> <xsl:apply-templates select =@*|node() /> </xsl:copy> </xsl:template> In word 2003, I am
In my xslt file I want to apply templates to the xml but only
What is the difference between <xsl:apply-templates /> and <xsl:apply-templates select=. /> . I thought
As part of a homework assignment in Lisp, I am to use apply or
How do I apply 'use base' in Perl to inherit subs from some base

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.