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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:44:05+00:00 2026-05-27T00:44:05+00:00

I am using a XSLT Transformer in Java. I am sure the problem is

  • 0

I am using a XSLT Transformer in Java. I am sure the problem is in the way I’m typing in the XSLT syntax.

Basically, I have to see if an attribute ‘id’ in one of the nodes of XML is equivalent to a value, the XSL should process a template. I need to pass this test value as a xsl:param. When I test it on a static value, it works cool:

<ul class="levelOneNav">
 <xsl:for-each select="level1[@id='sub-page-1']">
  <xsl:call-template name="level1"/>
  </xsl:for-each>
 <div class="clear"></div>
</ul>       

The testing portion is in second line above. AFAIK to put in a param inside the strings, the format is <xsl:for-each select="level1[@id='$ContentID']"> in which $ContentID is the xsl:param declared as <xsl:param name="ContentID"/>

So this is the code I’m keying in

<ul class="levelOneNav">
 <xsl:for-each select="level1[@id='$ContentID']">
  <xsl:call-template name="level1"/>
  </xsl:for-each>
 <div class="clear"></div>
</ul>       

but it doesn’t work. I’ve also tried using <xsl:for-each select="level1[@id='{$ContentID}']">
and it also fails.

Any advise is appreciated greatly. Please give me links if you feel I should learn something. Thanks for your time …

  • 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-27T00:44:05+00:00Added an answer on May 27, 2026 at 12:44 am

    No, that “AFAIK” is where you are wrong. Some string values in XSLT attributes certainly do accept a "{$param}" syntax (note the braces), but in your case what you are after is much simpler: @id=$ContentID

    EDIT: Note that the ‘{$param}’ applies for XSLT attributes, see example:

    <xsl:element name="{$namespace}:{$elementName}">
       <xsl:attribute name="{$attrName}"><xsl:value-of select="$value"/></xsl:attribute>
    </xsl:element>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create one table using XSLT and CSS. The table should look
I'm using the javax.xml.transform.Transformer class to perform some XSLT translations, like so: TransformerFactory factory
Using XSLT and XPath 1.0, I have a string I want to escape for
Is it possible to merge elements using XSLT. If I have the following XML
is there really no way to directly write formatted XML using javax.xml.stream.XMLStreamWriter (Java SE
I need to transform one XML document into another using XSLT (for now from
Hi Can anyone help me in html to xml conversion using xslt in java.I
how to set SOH and ETX by using xslt -1.0 I have tried numerous
I am using XSLT to remove unnecessary attributes from some nodes in a file.
I'm using XSLT 1.0 an want to transform an XML file. It works fine

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.