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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:29:31+00:00 2026-05-27T14:29:31+00:00

i am trying to transform my xml via java/xalan (2.7.1) with org.apache.xalan.xslt.Process class I

  • 0

i am trying to transform my xml via java/xalan (2.7.1) with org.apache.xalan.xslt.Process class

I am getting “Extra illegal tokens” and not sure of the work around

i basically want to pass in a parameter to a Template and then use that parameter as a attribute of a <xsl:when test="$textAlign eq 'center'">

if i pass a 'center' param into TableCell template, I would want to create a table cell that has it’s text centered, and of course, 'left' would get it’s contents left justified.

the error message is complaining about the 'center'

the quotes around center trip it up and seems like it should be okay.

here are a few snippets (sample xml and xsl)

    <ingredients>         
          <ingredient>
                <quantity>1 1/2</quantity>
                <foodstuff>flour</foodstuff>
          </ingredient>
    </ingredients>

and here is a sample xsl

<xsl:output method="html"/>
<xsl:template match="ingredients">
      <xsl:apply-templates select="ingredient"/>
</xsl:template>
.
<xsl:template match="ingredient">
  <xsl:call-template name="TableCell">
        <xsl:with-param name="cellValue" select="quantity" />
        <xsl:with-param name="textAlign" select="'center'" />
  </xsl:call-template>
</xsl:template>
.
<xsl:template name="TableCell">
  <xsl:param name="cellValue" />
  <xsl:param name="textAlign" />
  <xsl:choose>
      <xsl:when test="$textAlign eq 'center'">
      <td align='center'>
        <xsl:value-of select="$cellValue"/>
      </td>
    </xsl:when>
  </xsl:choose>
</xsl:template>

maybe there is another way to do this? I thought it was pretty simple but i guess I just not versed enough on xsl

I am using xalan 2.7.1 for my xsl engine

org.apache.xalan.xslt.Process -IN test.xml -XSL test.xsl -OUT out.html

thanks everyone

  • 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-27T14:29:31+00:00Added an answer on May 27, 2026 at 2:29 pm

    eq is an operator introduced in XPath and XSLT 2.0, you are using Xalan which only supports XPath and XSLT 1.0 so use the = operator instead.
    Or move from Xalan to Saxon 9 (http://saxon.sourceforge.net/), that processor supports XSLT 2.0.

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

Sidebar

Related Questions

I am trying to develop an XSLT stylesheet which will transform an xml into
I'm trying to transform some XML-data to HTML with XSLT for my bachelor thesis.
I'm trying to query an xml file using the following xslt: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I am trying to use VBScript to do an XSLT transform on an XML
I am trying to display xml data in html via XSLT. I am building
I'm trying to transform some XML into HTML using XSLT . Problem: I can't
I have the following line of xml that I'm trying transform using XSLT but
I am trying to use XSLT to transform a XML in to flat text.
I am trying to transform XML file twice with different XSLT files (Two step
I keep getting the above error when trying to transform XML that's generated in

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.