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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:49:36+00:00 2026-06-02T12:49:36+00:00

I have to get the attribute names and do some manipulations based on the

  • 0

I have to get the attribute names and do some manipulations based on the its name in XSLT.

Source:

<group  xlink:type="simple" xlink:href="XXX" xlink:title="sectionHeader_1" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
<group  xlink:type="simple" xlink:href="YYY" xlink:title="BodyParagraph_1" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
<group  xlink:type="simple" xlink:href="ZZZ" xlink:title="sectionHeader_2" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
<group  xlink:type="simple" xlink:href="AAA" xlink:title="sectionHeader_3" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
<group  xlink:type="simple" xlink:href="BBB" xlink:title="BodyParagraph_2" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
<group  xlink:type="simple" xlink:href="BBB" xlink:title="ConditionalText_2" xmlns:xlink="http://www.w3.org/1999/xlink"></group>

I have to get the attribute xlink:title attribute in it and check for the following:

  • when the attribute xlink:title contains string sectionHeader , I need to do some manipulations.
  • when the attribute xlink:title contains string BodyParagraph, I need to some manipulations.
  • when the attribute xlink:title contains string ConditionalText, I need to some manipulations.

Can any one explain how it can be done?

  • 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-02T12:49:38+00:00Added an answer on June 2, 2026 at 12:49 pm

    It is in the spirit of XSLT to use templates and pattern matching so that explicit conditional instructions are minimized or eliminated altogether.

    Here is how this can be done:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="group">
         <xsl:apply-templates select="@xlink:title"/>
     </xsl:template>
    
     <xsl:template match="@xlink:title[contains(., 'sectionHeader')]">
       Found @xlink:title containing "sectionHeader"
     </xsl:template>
    
     <xsl:template match="@xlink:title[contains(., 'BodyParagraph')]">
       Found @xlink:title containing "BodyParagraph"
     </xsl:template>
    
     <xsl:template match="@xlink:title[contains(., 'ConditionalText')]">
       Found @xlink:title containing "ConditionalText"
     </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on the provided XML fragment (converted to a well-formed XML document):

    <t>
        <group  xlink:type="simple" xlink:href="XXX" xlink:title="sectionHeader_1" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
        <group  xlink:type="simple" xlink:href="YYY" xlink:title="BodyParagraph_1" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
        <group  xlink:type="simple" xlink:href="ZZZ" xlink:title="sectionHeader_2" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
        <group  xlink:type="simple" xlink:href="AAA" xlink:title="sectionHeader_3" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
        <group  xlink:type="simple" xlink:href="BBB" xlink:title="BodyParagraph_2" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
        <group  xlink:type="simple" xlink:href="BBB" xlink:title="ConditionalText_2" xmlns:xlink="http://www.w3.org/1999/xlink"></group>
    </t>
    

    the wanted result (something done in each case) is produced:

       Found @xlink:title containing "sectionHeader"
    
       Found @xlink:title containing "BodyParagraph"
    
       Found @xlink:title containing "sectionHeader"
    
       Found @xlink:title containing "sectionHeader"
    
       Found @xlink:title containing "BodyParagraph"
    
       Found @xlink:title containing "ConditionalText"
    

    Do note: You may consider using the starts-with() function rather than contains() .

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

Sidebar

Related Questions

I have an attribute declared on property. How can I get the property name
I have 4 sub images on a page that get their src attribute from
I have created Controller Attribute and would like to read SessionId but get error
I have a number of CSS attributes and Classes which get applied based on
I've been trying to get the UNIQUE constraint placed on some attributes I have
I currently have a function: public static Attribute GetAttribute(MemberInfo Member, Type AttributeType) { Object[]
I have tried following some tutorials and I get the concept of how the
I'm using pyodbc to query an AS400 (unfortunately), and some column names have hashes
I have one table having ID and other attributes. How can I get list
So I have a class that has the following member variables. I have get

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.