Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 12th, 2009, 05:23 AM
Authorized User
 
Join Date: Oct 2008
Location: Pune, Maharashtra, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy how to find child node when there is mentioned (child::*)

Hi,

I have to find particular child node while there is mentioned child::*

XML
Code:
<body output="student/teacher">
<task>
 <title>foo</title>
 <group>
   <step>
       <para>Some text</para>
       <fig>
           <image href="..."/>
       </fig>
   </step>
 </group>
 <group>
   <step>
       <para>Some text</para>
       <note>                        [problem for this]
           <para>some text</para>
       </note>
     <note>                        [problem for this]
        <para>some text</para>
     </note>
   </step>
 </group>
</task>
<task>
 <title>foo</title>
 <group>
   <step>
       <para>Some text</para>
   </step>
 </group>
 <group>
   <step>
       <para>Some text</para>
       <note>                        [problem for this]
           <para>some text</para>
       </note>
   </step>
     <note>                        [problem for this]
        <para>some text</para>
     </note>   
 </group>
 <note>                        [No problem for this]
     <para>some text</para>
 </note>
</task>
</body>
For above xml; in xslt already in <group> element match as child::*.

Now I have to do some modification on attribute of <note> element. [on the basis of attribute value (which is common for all and It may present / may not present) i have to process]

for <note> element I give the condition but already present condition [child::*] overrides the my condition. And If i delete child::* then not able to copy all required element for final processing.


Please help.


Mahesh
  #2 (permalink)  
Old May 12th, 2009, 05:30 AM
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Your current description is not clear to me. Can you show us the transformation result corresponding to the input sample you have shown?
And if you already have an XSLT stylesheet that does not work as intended then you might want to show that as well and explain which templates in the stylesheet do not work as intended.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
  #3 (permalink)  
Old May 12th, 2009, 05:53 AM
Authorized User
 
Join Date: Oct 2008
Location: Pune, Maharashtra, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy

Hi Martin,

I am using Arbortext styler.

My Output is PDF.

Let me explain -

1] Structure is like the xml which i shown.
2] For pdf output there is a XSl:fo, present in Arbortext styler format.
3] The new requirement is that if <note> element is having some attribute value then it should be print for teacher not student. If that attribute is not present then it will print for both output.
4] For this i created a match that, if <note> element is having attribute and ancestor::body is having "student" then don't print
5] But there is a match for <group> element which combines all child and dispaly as table in output PDF.
6] In <group> match inside 1 <td> there is child::* is mentioned.
7] Because of this, though i am giving separate match for <note> doesn't work.
8] To solve this i should know how can i reach up to particular node while there is mention [child::*]
9] I tried as below in <group> element match but it doesn't work
A] child::*[not(note[@attribute='internal' and parent::step]) or not(note[@attribute='internal' and parent::group])]
10] This is the theory of my problem.

Please advice.

Mahesh
  #4 (permalink)  
Old May 12th, 2009, 12:40 PM
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

If you transform your XML to XSL:FO to produce PDF from that then I don't see why you could not show us the XSL:FO you want to create from your XML input.
I am afraid your second verbal description has not helped me to understand what you want to achieve and what the problem is with your current approach, other than that you are writing match patterns which do not achieve what you need.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing a node bases on child node value musman0047 XSLT 1 February 27th, 2009 12:26 PM
The reference node is not a child of this node.XSL XMLUser XSLT 2 February 25th, 2008 05:22 AM
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 05:30 AM
How to count the child node suri_1811 XSLT 6 November 10th, 2006 04:51 PM
Child Node Output Neal XSLT 0 June 7th, 2006 03:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.