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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:24:17+00:00 2026-05-25T19:24:17+00:00

This is my Xml File… <w:document> <w:body> <w:p> <w:r> <w:t> Paragraph1 </w:t> </w:r> </w:p>

  • 0

This is my Xml File…

<w:document>

        <w:body>

           <w:p>
                <w:r>
                    <w:t>
                      Paragraph1
                     </w:t>
                 </w:r>
             </w:p>
          </w:body>
</w:document>

This is my Second XML file…

 <w:document>
    <w:body>
        <w:p>
            <w:r>
               <w:pict>
                    <v:shape>
                       <v:textbox>
                           <w:txbxContent>
                              <w:p>
                                 <w:r>
                                    <w:t>
                                       Paragraph2
                                     </w:t>
                                 </w:r>
                                </w:p>
                             </w:txbxContent>
                           <v:textbox>
                        </v:shape>
                     </w:pict>
                  </w:r>
                </w:p>
              </w:body>
             </w:document>

Here, i have written one xslt file and calling my template whenever i found //w:body/w:p/w:r/w:t.

   for example,


 <xsl:apply-templates select="//w:body/w:p[w:r[w:t]]">
   </xsl:apply-templates>

my own template is

<xsl:template match="w:p">
            Do something here
       </xsl:template>

my xslt working correctly with my first xml document.But it is not working with second one and also some scenario like that.So, how can i achieve both of this scenario by modifying this query here…

<xsl:apply-templates select="?????"> <!-- how to find the case that also matching my second xml file -->
</xsl:apply-templates>

Please guide me get out of this issue…

  • 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-25T19:24:18+00:00Added an answer on May 25, 2026 at 7:24 pm

    Use:

    <xsl:apply-templates select="//w:p[w:r/w:t]"> 
    

    You may aso change the template’s match attribute to be slightly more specific:

    <xsl:template match="w:p[w:r/w:t]"> 
      <!-- Processing here -->
    </xsl:template> 
    

    Complete code:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:w="w:w">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="/">
       <xsl:apply-templates select="//w:p[w:r/w:t]"/>
     </xsl:template>
    
     <xsl:template match="w:p[w:r/w:t]">
      <xsl:value-of select="w:r/w:t"/>
     </xsl:template>
    </xsl:stylesheet>
    

    when this transformation is applied on the first provided XML document (namespace defined to make it well-formed):

    <w:document xmlns:w="w:w">
        <w:body>
            <w:p>
                <w:r>
                    <w:t>
                     Paragraph1
                 </w:t>
                </w:r>
            </w:p>
        </w:body>
    </w:document>
    

    the correct result is produced:

                 Paragraph1
    

    when the same transformation is applied on the second provided “XML” (it is severely malformed and I spent many minutes until I made it well-formed!!!):

    <w:document xmlns:w="w:w">
        <w:body>
            <w:p>
                <w:r>
                    <w:pict>
                        <v:shape xmlns:v="v:v">
                            <v:textbox>
                                <w:txbxContent>
                                    <w:p>
                                        <w:r>
                                            <w:t>
                          Paragraph2
                                            </w:t>
                                        </w:r>
                                    </w:p>
                                </w:txbxContent>
                            </v:textbox>
                        </v:shape>
                    </w:pict>
                </w:r>
            </w:p>
        </w:body>
    </w:document>
    

    again the wanted result is produced:

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

Sidebar

Related Questions

Suppose i have an xml document like this XML File: <document> <educationalsection> educational details
I have this xml file <?xml version=1.0 encoding=UTF-8?> <bo:C837ClaimParent xsi:type=bo:C837ClaimParent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:bo=http://somelongpathHere/process/bo> <claimAux> ...
Here is my ultimate goal... to take this xml file.. <?xml version=1.0?> <Songs> <Song>
Say I have this given XML file: <root> <node>x</node> <node>y</node> <node>a</node> </root> And I
In this the catalog.xml file. I have two books who have the same inventory
I have an xml file like this: <root> <item> <name>one</name> <status>good</status> </item> <item> <name>two</name>
I have an XML file looks like this: <?xml version=1.0 encoding=utf-8 ?> <PathMasks> <Mask
I have this XML file, from which I'd like to count the number of
I have this xml file: Response: <ns3:ExecuteResponse xmlns:ns3=http://www.opengis.net/wps/1.0.0 xmlns:ns1=net/ows/1.1 xmlns:ns2=http://www.w3.org/1999/xlink statusLocation=xxxxf62 serviceInstance=http:/http-post version=1.0.0 service=xxx>
I have this XML file of size 2.8GB (Polish Wikipedia dump). I have to

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.