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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:19:42+00:00 2026-06-12T09:19:42+00:00

Hi I want to populate the value of maxbars variable in the width in

  • 0

Hi I want to populate the value of maxbars variable in the width in the percentage format, but for some reasons its not taking its value. Can you please help.

Example: I want to display it as width:10.9% format

<xsl:for-each select="catalog/cd/price">
 Current node:
 <xsl:variable name="maxbars" select="."/>
 <div style="width: 200px; height: 20px;">
 <div style="width: maxbars%; height: 18px; background-color: red"></div>
 </div>
 <br/>
 </xsl:for-each>



<catalog>
<cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
</cd>
<cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
</cd>

  • 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-12T09:19:42+00:00Added an answer on June 12, 2026 at 9:19 am

    You must indicate that you are using the maxbars variable. If you are using it inside of an attribute, you can use XSL-T’s curly brace syntax for xPath expressions:

    <div style="width: {$maxbars}%; height: 18px; background-color: red"></div>
    

    Important: The braces are placed around the expression and you use the $ inside of the braces.

    If you want to insert variables (and other xPath expressions) outside of attributes, then you must use the <xsl:value-of> element:

    <span>Price: <xsl:value-of select="$maxbars"/></span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know how can i populate a value of input type text
I want to populate my textbox with value from an element. Perhaps my code
I have a dropdownlist that I want to populate with a specific value and
I want to populate the database by sample data, and for some reason, I
i want populate data in parent window from a popup window. can any one
I want to populate some values in a sheet and then use jxl Formula
I want to populate some text boxes while clicking the next row on the
I have spinner which I populate from SQLite database. But I want to populate
I am looking into using High Charts, but I want to populate the data
In a nutshell: I have some database table data that I want to populate

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.