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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:08:48+00:00 2026-06-10T10:08:48+00:00

<page> <tab dim=70></tab> <tab dim=40></tab> <tab dim=30></tab> <tab dim=30></tab> <tab dim=30></tab> <tab dim=70></tab> </page>

  • 0
<page>
  <tab dim="70"></tab>
  <tab dim="40"></tab>
  <tab dim="30"></tab>
  <tab dim="30"></tab>
  <tab dim="30"></tab>
  <tab dim="70"></tab>
</page>

how to get the value of tab’s dim attributes and take out the distinct value using xslt.means it will print 30,40,70

  • 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-10T10:08:49+00:00Added an answer on June 10, 2026 at 10:08 am

    To select the distinct attribute values, you can use this XPath:

    /page/tab[not(@dim=preceding-sibling::tab/@dim)]/@dim
    

    A possible XSLT template would be

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="text" />
        <xsl:template match="/">
            <xsl:for-each select="/page/tab[not(@dim=preceding-sibling::tab/@dim)]/@dim">
                <xsl:sort select="." data-type="number"/>
                <xsl:value-of select="concat(., substring(',', 2 - (position() != last())))"/>
            </xsl:for-each>
        </xsl:template>
    </xsl:stylesheet>
    

    To transform the source document with the stylesheet in PHP, you can use:

    $xml = new DOMDocument;
    $xml->load('collection.xml');
    $xsl = new DOMDocument;
    $xsl->load('collection.xsl');
    $proc = new XSLTProcessor;
    $proc->importStyleSheet($xsl);
    echo $proc->transformToXML($xml);
    

    This will give 30,40,70 in the output.

    You can achieve the same without an XSLT by simply doing:

    $page = simplexml_load_file('NewFile.xml');
    $dims = $page->xpath('/page/tab[not(@dim=preceding-sibling::tab/@dim)]/@dim');
    $dims = array_map('strval', $dims);
    sort($dims);
    echo implode(',', $dims);
    

    Also see

    • http://schlitt.info/opensource/blog/0704_xpath.html
    • How do I generate a comma-separated list with XSLT/XPath?
    • XPath 1.0 select distinct attribute of siblings
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a Facebook Page Tab app where a user will be drawing on
I'm using Facebook JS SDK to develop a Facebook Page Tab application. There is
I'm trying to get the .Left property of a specific tab page in a
My Page Tab tells people to Like the page using the Like Button next
When sending an AppRequest using from a page Tab: FB.ui({ method : 'apprequests', message
I am calling the Facebook Add Page Tab Dialog using the Javascript SDK as
I am developing a Facebook page tab that will hold a competition. So firstly
I have made an app which will be a FB page tab. Now I
I have a Facebook Page Tab app and I'm trying to find out where
I'm building a Page Tab application that will allow Facebook users to make purchases

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.