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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:02:53+00:00 2026-06-12T04:02:53+00:00

I am using XSLT params to set an absolute path in an attribute at

  • 0

I am using XSLT params to set an absolute path in an attribute at runtime using Xalan-C. Basically, my input XML is something like this :-

<root xmlns="initial">
  <!-- document goes here -->
</root>

My stylesheet is :-

<xsl:stylesheet version="1.0" xmlns:s="initial" xmlns="final" />

  <xsl:param name="default_data_location">/path/to/some/location</xsl:param>

  <xsl:template match="//s:*">
    <xsl:element name="{local-name()}" namespace="final">
      <xsl:attribute name="dataLocation">
        <xsl:value-of select="concat($default_data_location, '/datafile')"/>
      </xsl:attribute>
    </xsl:element>
  </xsl:template>

  <!-- rest of the stylesheet -->

</xsl:stylesheet>

Thus, my desired output XML when I run it as :-

Xalan foo.xml foo.xsl 

should be (this is the part that works) :-

<root xmlns="final" dataLocation="/path/to/some/location/datafile">
  <!-- document goes here -->
</root>

And when I run it as :-

Xalan -p default_data_location /some/other/path foo.xml foo.xsl

it should be (and this is the part that doesn’t work) :-

<root xmlns="final" dataLocation="/some/other/path/datafile">
  <!-- document goes here -->
</root>

If I try to set this param at the command line, however, it gives me the following XML :-

<root xmlns="final" dataLocation="/datafile">
  <!-- document goes here -->
</root>

What should I be doing?

  • 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-12T04:02:54+00:00Added an answer on June 12, 2026 at 4:02 am

    The parameter value seems to be an XPath expression so you need to make sure you pass in an XPath string and you might need to double quotes to make sure the command line shell does not get into your way so doing Xalan -p default_data_location "'/some/other/path'" foo.xml foo.xsl should work. At least that’s my reading of the documentation at http://xml.apache.org/xalan-c/commandline.html, I don’t have Xalan-C to test.

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

Sidebar

Related Questions

I'm starting using XSLT and write this scipt: <?xml version=1.0 encoding=ISO-8859-1?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform>
I would like to merge two xml files into one using xslt. file1: <cut>
I transform some RSS XML feeds using XSLT. Basically there are two types I
I am using xslt 2.0 for transforming one xml format to another xml format.But
I'm using XSLT 1.0 an want to transform an XML file. It works fine
I am using XSLT with C# . My input tag is in the format
I'm using xslt 1.0 to transform some xml returned via a Server.Execute on an
I'm trying to read in an XML feed using an XSLT Macro in Umbraco
how to set SOH and ETX by using xslt -1.0 I have tried numerous
Using XSLT 2.0: @ Linenumber 8370 this code: <TestCaseElement> <Name><![CDATA[DUT_AC_ON]]></Name> <TaggedValues> </TaggedValues> <Description> <Line><![CDATA[{TEXT_LANG}

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.