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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:55:10+00:00 2026-05-28T00:55:10+00:00

I need help in creating an XSLT style sheet. Namely, I cannot select the

  • 0

I need help in creating an XSLT style sheet. Namely, I cannot select the node and apply the template for it. Here are the input and output xmls and my XSLT :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
    <searchresult>
        <query>
            <xsl:value-of select="/feed/title"/>
        </query>
        <xsl:apply-templates select="doc-template"/>
    </searchresult>
</xsl:template>
<xsl:template name="doc-template" match="entry">
    <document>
        <title>
            <xsl:value-of select="title"/>
        </title>
        <snippet>
            <xsl:value-of select="content"/>
        </snippet>
    </document>
</xsl:template>
</xsl:stylesheet>

and the XML file is:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/" xmlns:georss="http://www.georss.org/georss">
    <title>salsa - Twitter Search</title>
    <entry>
        <id>tag:search.twitter.com,2005:156464188011708416</id>
        <published>2012-01-09T19:55:44Z</published>
        <link type="text/html" href="http://twitter.com/RodFF/statuses/156464188011708416" rel="alternate"/>
        <title>Al fin ponen mi tanda! @Anelito_Amed @samueltejeira @Elieser_Soriano @jose2734 #salsa #frankieruiz</title>
        <content type="html">Al fin ponen mi tanda! @&lt;a class=" " href="http://twitter.com/Anelito_Amed"&gt;Anelito_Amed&lt;/a&gt; @&lt;a class=" " href="http://twitter.com/samueltejeira"&gt;samueltejeira&lt;/a&gt; @&lt;a class=" " href="http://twitter.com/Elieser_Soriano"&gt;Elieser_Soriano&lt;/a&gt; @&lt;a class=" " href="http://twitter.com/jose2734"&gt;jose2734&lt;/a&gt; #&lt;em&gt;salsa&lt;/em&gt; &lt;a href="http://search.twitter.com/search?q=%23frankieruiz" title="#frankieruiz" class=" "&gt;#frankieruiz&lt;/a&gt;</content>
        <updated>2012-01-09T19:55:44Z</updated>
        <link type="image/png" href="http://a1.twimg.com/profile_images/1672210480/IMG-20111008-00231_normal.jpg" rel="image"/>
        <twitter:geo></twitter:geo>
        <twitter:metadata>
            <twitter:result_type>recent</twitter:result_type>
        </twitter:metadata>
        <twitter:source>&lt;a href="http://blackberry.com/twitter" rel="nofollow"&gt;Twitter for BlackBerry&#xae;&lt;/a&gt;</twitter:source>
        <twitter:lang>es</twitter:lang>
        <author>
            <name>RodFF (Rodolfo Franceschi )</name>
            <uri>http://twitter.com/RodFF</uri>
        </author>
    </entry>
    <entry>
        <id>tag:search.twitter.com,2005:156464182433288194</id>
        <published>2012-01-09T19:55:42Z</published>
        <link type="text/html" href="http://twitter.com/Olqa_N/statuses/156464182433288194" rel="alternate"/>
        <title>No causo el efecto que imaginaste No me hizo el danio que tu pensaste no llore mas de lo que creiste no hiciste falta cuando te fuiste#salsa</title>
        <content type="html">No causo el efecto que imaginaste No me hizo el danio que tu pensaste no llore mas de lo que creiste no hiciste falta cuando te fuiste#&lt;em&gt;salsa&lt;/em&gt;</content>
        <updated>2012-01-09T19:55:42Z</updated>
        <link type="image/png" href="http://a3.twimg.com/profile_images/1734507487/IMG01812-20110621-1025_jpg_normal.jpg" rel="image"/>
        <twitter:geo></twitter:geo>
        <twitter:metadata>
            <twitter:result_type>recent</twitter:result_type>
        </twitter:metadata>
        <twitter:source>&lt;a href="http://ubersocial.com" rel="nofollow"&gt;&#xdc;berSocial for BlackBerry&lt;/a&gt;</twitter:source>
        <twitter:lang>es</twitter:lang>
        <author>
            <name>Olqa_N (Olqa Lopez)</name>
            <uri>http://twitter.com/Olqa_N</uri>
        </author>
    </entry>
</feed>
  • 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-28T00:55:11+00:00Added an answer on May 28, 2026 at 12:55 am

    As @Zachary Young said, you need to use namespace prefixes in XSLT paths when the target elements have a non-empty namespace URI.

    The following document contains an xmlns:atom declaration with the URI used in the source document. It also uses the atom: prefix in XPath steps. I’ve also made other modifications to achieve what I think you were trying to do using an “XSLT” kind of idiom.

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
         xmlns:atom="http://www.w3.org/2005/Atom">
    <xsl:output method="xml" encoding="utf-8" indent="yes"/>
    
    <xsl:template match="/atom:feed">
    <searchresult>
     <query>
        <xsl:value-of select="atom:title"/>
      </query>
        <xsl:apply-templates select="atom:entry"/>
    </searchresult>
    </xsl:template>
    
    <xsl:template match="atom:entry">
    <document>
      <title>
        <xsl:value-of select="atom:title"/>
      </title>
      <snippet>
        <xsl:value-of select="atom:content"/>
      </snippet>
    </document>
    </xsl:template>
    </xsl:stylesheet>
    

    It produces the following output on our XML (which I’ve indented):

    <searchresult xmlns:atom="http://www.w3.org/2005/Atom">
        <query>salsa - Twitter Search</query>
        <document>
            <title>Al fin ponen mi tanda! @Anelito_Amed @samueltejeira @Elieser_Soriano @jose2734 #salsa #frankieruiz</title>
            <snippet>Al fin ponen mi tanda! @&lt;a class=" " href="http://twitter.com/Anelito_Amed"&gt;Anelito_Amed&lt;/a&gt; @&lt;a class=" " href="http://twitter.com/samueltejeira"&gt;samueltejeira&lt;/a&gt; @&lt;a class=" " href="http://twitter.com/Elieser_Soriano"&gt;Elieser_Soriano&lt;/a&gt; @&lt;a class=" " href="http://twitter.com/jose2734"&gt;jose2734&lt;/a&gt; #&lt;em&gt;salsa&lt;/em&gt; &lt;a href="http://search.twitter.com/search?q=%23frankieruiz" title="#frankieruiz" class=" "&gt;#frankieruiz&lt;/a&gt;</snippet>
        </document>
        <document>
            <title>No causo el efecto que imaginaste No me hizo el danio que tu pensaste no llore mas de lo que creiste no hiciste falta cuando te fuiste#salsa</title>
            <snippet>No causo el efecto que imaginaste No me hizo el danio que tu pensaste no llore mas de lo que creiste no hiciste falta cuando te fuiste#&lt;em&gt;salsa&lt;/em&gt;</snippet>
        </document>
    </searchresult>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a help about creating custom wpf controls.I want to create a template
I need help creating the php for my contact form, here is the form
I need help with creating a C# method that returns the index of the
I need a little help creating a catch-all error handling page in my ICEfaces
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
I need help creating an object for this declare UIWebView *webView; I thought it
I need help creating a self extracting zip file that does not display anything.
i need help with creating a regex for putting all values into an array!
I need some help creating the necessary Javascript to add values to an existing
Need some help in creating function which can create folders recursively with giving path:

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.