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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:48:23+00:00 2026-05-16T10:48:23+00:00

I have the following XML <?xml version=1.0 encoding=ISO-8859-1?> <?xml-stylesheet type=text/xsl href=example3.xsl?> <pics> <page no=1>

  • 0

I have the following XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="example3.xsl"?>
<pics>
    <page no="1">
      <pic>
       <td>
         <no src="http://www.templetons.com/brad/pq/playaphone.jpg" width="150" height="120">1</no>
       </td>       
      </pic>
      <pic>
       <td>
         <no src="http://motherjones.com/files/legacy/mojoblog/funny-cats-a10.jpg" width="150" height="120">4</no>
      </td>    
      </pic>
    </page>
    <page no="2">      
      <pic>
       <td>
         <no src="http://motherjones.com/files/legacy/mojoblog/funny-cats-a10.jpg" width="150" height="120">4</no>
      </td>    
      </pic>
      <pic>
       <td>
         <no src="http://www.templetons.com/brad/pq/playaphone.jpg" width="150" height="120">1</no>
       </td>       
      </pic>      
    </page>
</pics>

I want using XSL file select only one page
This one gives me both:

<xsl:for-each select="pics/page/pic">
    <tr>
      <xsl:for-each select="td">
        <td><img>
          <xsl:attribute name="src">
            <xsl:value-of select="no//@src"/>
          </xsl:attribute>
          <xsl:attribute name="width">
            <xsl:value-of select="no//@width"/>
          </xsl:attribute>
          <xsl:attribute name="height">
            <xsl:value-of select="no//@height"/>
          </xsl:attribute>
        </img></td>
      </xsl:for-each>
    </tr>
  </xsl:for-each>

Where and how can I filter/select or address the no=”x” attribute?

Thanks Asaf

  • 1 1 Answer
  • 3 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-16T10:48:24+00:00Added an answer on May 16, 2026 at 10:48 am

    Change this:

    <xsl:for-each select="pics/page/pic">                    
        <tr>                    
          <xsl:for-each select="td">                    
            <td><img>                    
              <xsl:attribute name="src">                    
                <xsl:value-of select="no//@src"/>                    
              </xsl:attribute>                    
              <xsl:attribute name="width">                    
                <xsl:value-of select="no//@width"/>                    
              </xsl:attribute>                    
              <xsl:attribute name="height">                    
                <xsl:value-of select="no//@height"/>                    
              </xsl:attribute>                    
            </img></td>                    
          </xsl:for-each>                    
        </tr>                    
      </xsl:for-each>     
    

    into this:

    <xsl:apply-templates select="pics/page/pic"/> 
    

    and add the processing in a template:

    <xsl:template match="pic">
     <tr> 
       <xsl:for-each select="td"> 
        <td>
         <img src="{no/@src}" width="{no/@width}" height="{no/@height}"/> 
        <td> 
       </xsl:for-each> 
     </tr> 
    </xsl:template>
    

    Then to exclude (filter) a particular pic (say the 2nd), add this empty template:

    <xsl:template match="pic[@no='2']"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML: <?xml version=1.0?> <?xml-stylesheet type=text/xsl href=http://www.test.com/AuditTrail.xsl?> and XSL: <?xml version=1.0
We have a page similar to the following: <?xml version=1.0 encoding=ISO-8859-1?> <!DOCTYPE html PUBLIC
Consider the following XSLT script: <?xml version=1.0 encoding=ISO-8859-1?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=text encoding=iso-8859-1/>
I have the following XML <?xml version=1.0 encoding=ISO-8859-1 ?> - <DEVICEMESSAGES> <VERSION xml=1 checksum=
I have the following XML in a string named 'xml': <?xml version=1.0 encoding=ISO-8859-1?> <Book>
I have the following XML data: <?xml version=1.0 encoding=iso-8859-1?> <results> <result> <MemberFirstName>JOHN</MemberFirstName> <MemberLastName>DOE</MemberLastName> <MemberLogin>1</MemberLogin>
I have an XML file like the following : <?xml version=1.0 encoding=ISO-8859-1 ?> <mylist
i have the following xml <?xml version=1.0 encoding=ISO-8859-1 ?> <bookstore> <book category=cooking> <title lang=en>Everyday
I have the following XML: <?xml version=1.0 encoding=ISO-8859-1?> <results> <ip>195.72.186.157</ip> <country>UNITED KINGDOM (UK)</country> <city>Oxford</city>
For example I have the following XML file: <?xml version=1.0 encoding=ISO-8859-1?> <bookstore> <book> <title

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.