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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:04:34+00:00 2026-06-10T03:04:34+00:00

I have a XSLT transformation: <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0> <xsl:output method=xml indent=yes

  • 0

I have a XSLT transformation:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:output method="xml"
                indent="yes"
                version="1.0"
                encoding="UTF-16"              
                standalone="yes"                        
                cdata-section-elements="title date referencenumber url company city state country postalcode description salary education jobtype category experience"/>

    <xsl:param name="currentDate"/>

    <xsl:template match="/response/result">
        <source>            
            <xsl:for-each select="//doc">
                <job>
                    <title>
                        <xsl:value-of select="str[@name='title']"/>
                    </title>
                    <date>
                        <xsl:value-of select="date[@name='ds_field_ad_publish']"/>
                    </date>
                    <referencenumber>
                        <xsl:value-of select="int[@name='nid']"/>
                    </referencenumber>
                </job>
            </xsl:for-each>            
        </source>
    </xsl:template>   

</xsl:stylesheet>

And here is my XML document:

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">4</int>
        <lst name="params">
            <str name="wt">xml</str>
            <str name="fq">type:ad_vacancy is_organisation_nid:190908</str>
            <str name="rows">1000000</str>
        </lst>
    </lst>
    <result name="response" numFound="2" start="0">
        <doc>
            <!-- all my values -->
        </doc>
        <doc>
            <!-- all my values -->
        </doc>
        <doc>
            <!-- all my values -->
        </doc>
    </result>
</response>

I am matching /response/result and then looping through all the <doc> elements. Everything works fine, but at the top of my document I am seeing the values from <lst> element. Like this:

0
4

    xml
    type:ad_vacancy is_organisation_nid:190908
    1000000

I need to somehow escape that whole block, that my transformation would not match it. I have tried different expressions like: <xsl:template match="//response/result">, <xsl:template match="//response//result">. I also tried to add this into my transfromation:

<xsl:template match="/*">
    <xsl:apply-templates/>
</xsl:template>

But that did not helped as well. The values from <lst> still remains. Is there a way to get rid of them?

  • 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-10T03:04:36+00:00Added an answer on June 10, 2026 at 3:04 am

    Just add this to your template: <xsl:template match="text() | @*"/>
    It matches text nodes and attributes and since the template is empty it does nothing to them. It is actually a "built-in-template" –> http://www.w3.org/TR/xslt#built-in-rule

    Your edited XSLT looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    
    <xsl:output method="xml"
        indent="yes"
        version="1.0"
        encoding="UTF-16"              
        standalone="yes"                        
        cdata-section-elements="title date referencenumber url company city state country postalcode description salary education jobtype category experience"/>
    
    <xsl:param name="currentDate"/>
    
    <xsl:template match="text() | @*"/>
    
    <xsl:template match="/response/result">
        <source>            
            <xsl:for-each select="//doc">
                <job>
                    <title>
                        <xsl:value-of select="str[@name='title']"/>
                    </title>
                    <date>
                        <xsl:value-of select="date[@name='ds_field_ad_publish']"/>
                    </date>
                    <referencenumber>
                        <xsl:value-of select="int[@name='nid']"/>
                    </referencenumber>
                </job>
            </xsl:for-each>            
        </source>
    </xsl:template>   
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this XSLT 2.0: <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output indent=yes/> <xsl:strip-space elements=*/> <xsl:template match=node()|@*>
<xsl:stylesheet xmlns=http://www.w3.org/1999/xhtml version=1.0 xmlns:ms=urn:schemas-microsoft-com:xslt xmlns:infoRequest=ControlSkin3 xmlns:xsl=http://www.w3.org/1999/XSL/Transform exclude-result-prefixes=xmlns> <xsl:output omit-xml-declaration=yes method=xml encoding=utf-8 /> I've got
i have xml file and xslt transformation below: <?xml version=1.0 encoding=utf-8 ?> <?xml-stylesheet version=1.0
I have this XML file: <?xml version=1.0?> <xi:include href=http://www.w3schools.com/dom/books.xml xmlns:xi=http://www.w3.org/2003/XInclude/> and I expected that
Taking the XSLT and XML from this page as an example: http://www.w3schools.com/xsl/xsl_transformation.asp I have
I have written a C# code for triggering an XML to XML (XSLT) transformation.
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have an XSLT stylesheet that transforms an XML file to JSON format and
I have a complicated XML and I am trying to write a XSL transformation
For XSLT transformation I need a javax.xml.transform.stream.StreamSource object representing xml file being transformed. I

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.