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

  • Home
  • SEARCH
  • 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 8749189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:39:10+00:00 2026-06-13T12:39:10+00:00

I want the $content to be the expected string. I know that copy-of instead

  • 0

I want the $content to be the expected string. I know that copy-of instead of value-of $content produces the expected string. But how do I not use copy-of and pass it to say a java extension function?

I asked a different related question here.

XML

<?xml version="1.0"?>
<a>
  <b c="d"/>
  <b c="d"/>
  <b c="d"/>
</a>

XSL

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template name="foo">
        <xsl:param name="content"></xsl:param>
        <!-- <xsl:copy-of select="$content"></xsl:copy-of> -->
        <!-- copy-of produces the expected string here, but how to pass to Java -->
        <xsl:value-of select="java:someMethod($content)" />
        <!-- I want the content to be the expected string -->
    </xsl:template>

    <xsl:template match="/">
        <xsl:call-template name="foo">
            <xsl:with-param name="content">
                <xsl:for-each select="a/b">
                    <e>
                        <xsl:value-of select="@c" />
                    </e>
                </xsl:for-each>
            </xsl:with-param>
        </xsl:call-template>
    </xsl:template>
</xsl:stylesheet>

Desired String to be passed to Java extension function from $content.

<?xml version="1.0"?>
<e>d</e>
<e>d</e>
<e>d</e>

PS: Calling foo is mandatory.

Ultimately, my objective is to emulate result-document in XSLT 1.0 with extension function.

  • 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-13T12:39:11+00:00Added an answer on June 13, 2026 at 12:39 pm

    Calling Java extension functions depends on which XSLT processor you are using, which you haven’t told us. If you use Java’s TransformerFactory you will get whatever is on the classpath, for example the built-in version of Xalan, the Apache version of Xalan, or Saxon.

    Your description suggests you want to pass a string containing lexical XML to your Java extension function. That implies you need to serialize a node to a string. That can’t be achieved without an extension function such as saxon:serialize(). It’s probably easier to pass the node to your Java method, and have the Java method do the serialization.

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

Sidebar

Related Questions

I have a menu that changes and I want to show content in the
Want to have vertical scroll bar if content is more than expected in popwindow...
I use PHP and Simple XML. I use a loop that does not work
I want to read a whole file into a string and then use the
I want to have this , but instead have this . Please note, when
I want to replace an unescaped slash in a string with backslash. But something
I want the content of a web page to be centered and max width
I'm working on this website in WordPress and I want the content with the
I want to change content of a Button in XAML using a DataTrigger. Conditionally
i want update textarea content onclock on a input button for example: <input type=button

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.