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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:10:36+00:00 2026-06-11T17:10:36+00:00

In XSLT, using , it generates a line break before the rendered value and

  • 0

In XSLT, using , it generates a line break before the rendered value and another one after it.
Here comes an example:

<xsl:when test="name(.) = 'Item'">
     "<xsl:value-of select="./Item/Data[last()]/text()"/>"
</xsl:when>

And the rendered result is:


                                                   "
                                             09/07/2012
"

As you can see, it puts two line breaks before and after the result value, while the desired result is:

"09/07/2012"

The original input is :

Here comes the original input, sorry for that.

                                      <Item>
                                         <Item>
                                            <Data>105</Data>
                                            <Data>09/07/2012</Data>
                                         </Item>
                                      </Item>

I’m executing this XSLT within an Oracle Server Bus

Any help will be appreciated.

  • 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-11T17:10:37+00:00Added an answer on June 11, 2026 at 5:10 pm

    The extra space is could also be coming from the selected text. Use normalize-space() to remove this.

    <xsl:value-of select="normalize-space(./Item/Data[last()]/text())"/>
    

    Edit Overnuts is correct in using <xsl:text> around the quotes, otherwise the Xslt processor will preserve the newline before the opening / after the closing quotes. However, I still can’t see why a newline could get in between the quotes and your xsl:value-of?

    I’ve tried the following

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
        <xsl:strip-space elements="*"/>
    
        <xsl:template match="/xml" xml:space="default">
            <xsl:apply-templates select="*" />
        </xsl:template>
    
        <xsl:template match="*" xml:space="default">
            <xsl:choose>
                <xsl:when test="name(.) = 'Item'">
                    <xsl:text>"</xsl:text>
                    <xsl:value-of select="normalize-space(./Item/Data[last()]/text())"/>
                    <xsl:text>"</xsl:text>
                </xsl:when>
            </xsl:choose>
        </xsl:template>
    
    </xsl:stylesheet>
    

    When run with this XML:

    <xml>
        <Item>
            <Item>
                <Data>105</Data>
                <Data>09/07/2012</Data>
            </Item>
        </Item>
    </xml>
    

    Produces "09/07/2012"

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

Sidebar

Related Questions

I am using xslt 2.0 for transforming one xml format to another xml format.But
I'm using xslt do display Solr response in html, my xsl file is in
So I'm using the identity design pattern for XSLT: <xsl:template match=@*|node()> <xsl:copy> <xsl:apply-templates select=@*|node()[not(@visible='false')]/>
Using XSLT 2.0: @ Linenumber 8370 this code: <TestCaseElement> <Name><![CDATA[DUT_AC_ON]]></Name> <TaggedValues> </TaggedValues> <Description> <Line><![CDATA[{TEXT_LANG}
I'm trying to move a Sharepoint Subsite into another one using the stsadm export
Pretty green on XSLT and one of the systems I'm working on is using
Okay; using the Umbraco CMS I have a xslt menu being generated in the
I am looking to sort an XML structure using XSLT using xsltproc: The xml
Using XSLT and XPath 1.0, I have a string I want to escape for
I am using XSLT 1.0 and C# 2.0. and I want to cache my

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.