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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:14:04+00:00 2026-05-27T07:14:04+00:00

I have some XML data that I want to convert to HTML with XSLT

  • 0

I have some XML data that I want to convert to HTML with XSLT and I have mostly got it right. The problem with my XML input is that it contains inline if statements / boolean expressions that I have no idea how to handle.

<section>
  <title>My Title</title>
  <paragraph>
    <phrase class="inline-if">if_xVariable || if_yVariable</phrase>
    Show this text if if_xVariable or if_yVariable is true.
  </paragraph>
  <paragraph>
    <phrase class="inline-if">if_xVariable &amp;&amp; if_yVariable</phrase>
    Show this text if if_xVariable and if_yVariable is true
  </paragraph>
  <paragraph>
    Always show this text
  </paragraph>
</section>

I have been thinking of adding xslt-vairables with each variable name (e.g. if_xVariable) to true/false and in some way check against them.

How would you go about to solve this problem?

Update This is what I’ve tried

<xsl:template match="section/paragraph">
  <xsl:variable name="inlineif" select="phrase[@class='inline-if']"/>
    <xsl:if test="$inlineif">
      <p>
      <xsl:value-of select="."/>
      </p>
    </xsl:if>
</xsl:template>

Since I have neither of if_xVariable or if_yVariable specified, the output should probably be something like

<p>
Always show this text
</p>

but instead I get the output from all of the paragraphs.

  • 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-27T07:14:04+00:00Added an answer on May 27, 2026 at 7:14 am

    XSLT has no built-in dynamic evaluation of expressions. Possible solutions are discussed in the answer to this question.

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

Sidebar

Related Questions

I have one problem , I want to get some data from XML file
I have some XML data representing a mathematical expression tree and want to convert
I have some XML data that I want to transmit to a web server
I have some data in a database that I need represented in an XML
I have a file which is an XML representation of some data that is
I have some XML which contains records and sub records, like this: <data> <record
I have some non well-formed xml (HTML) data in JAVA, I used JAXP Dom,
I have some data that I export into an XML file and put in
I have an XML file containing some scientific text that I want to display
I have some reference data in a text file (~5MB) that I want to

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.