p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XSLT
I forgot my password Register Now
Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 6th, 2009, 11:38 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Need to redirect XML outputted by style sheet back into same style sheet

Hello,

The style sheet is changing an attribute from the original XML. It is also creating a report that calls that attribute and printing it out in a .csv. The problem is the report calls the attribute from the original XML when it needs to call the changed attribute.

Can the output XML be redirected back into the style sheet and processed for the .csv report?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old November 6th, 2009, 11:42 AM
Friend of Wrox
Points: 3,131, Level: 23
Points: 3,131, Level: 23 Points: 3,131, Level: 23 Points: 3,131, Level: 23
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Nov 2007
Location: Germany
Posts: 655
Thanks: 0
Thanked 98 Times in 97 Posts
Default

With XSLT 2.0 you can certainly easily create a temporary result and process it further. You only need to be careful that you don't end up with infinite processing, for instance by using different modes for each processing step.
With XSLT 1.0 you would need to use an extension function like exsl:node-set to convert a temporary result in the form of a result tree fragment into a node-set to process it further. Again using modes to distinguish between processing steps makes sense.
__________________
Martin Honnen
Microsoft MVP - XML
My blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old November 6th, 2009, 02:38 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

"With XSLT 2.0 you can certainly easily create a temporary result and process it further."

Sorry, but I am too new to xslt to know how to do that. The document function was recommended to me, and I'll look into that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old November 6th, 2009, 02:44 PM
Friend of Wrox
Points: 3,131, Level: 23
Points: 3,131, Level: 23 Points: 3,131, Level: 23 Points: 3,131, Level: 23
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Nov 2007
Location: Germany
Posts: 655
Thanks: 0
Thanked 98 Times in 97 Posts
Default

A temporary result is simply a result stored in a variable:
Code:
<xsl:template match="/">
  <xsl:variable name="v1">
     <xsl:apply-templates/>
  </xsl:variable>
  <xsl:apply-templates select="$v1/*" mode="m1"/>
</xsl:template>
<!-- now write templates for the default mode that perform the first step
      and templates for the mode m1 that perform the second step e.g. -->
<xsl:template match="foo">
   <xsl:copy>
     <xsl:attribute name="bar">value</xsl:attribute>
   </xsl:copy>
</xsl:template>

<xsl:template match="foo" mode="m1">
  <xsl:value-of select="@bar"/>
</xsl:template>
__________________
Martin Honnen
Microsoft MVP - XML
My blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
The Following User Says Thank You to Martin Honnen For This Useful Post:
Kenneth.Dougherty (November 9th, 2009)
  #5 (permalink)  
Old November 9th, 2009, 04:29 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 7%
Activity: 7% Activity: 7% Activity: 7%
 
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default thanks for the help

Thanks for the advice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the style sheet of the Master Page dotnetDeveloper BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 August 4th, 2008 10:56 AM
Chapter 2 -- Style Sheet problem. Doug Happ BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 January 10th, 2008 01:14 PM
cascading style sheet problem nikotromus ASP.NET 2.0 Professional 0 March 24th, 2006 07:49 PM
need xsl style sheet help please!(im a begginer) klipss XSLT 2 July 25th, 2005 03:10 PM
Setting the Style Sheet class jacob ASP.NET 1.0 and 1.1 Basics 4 August 20th, 2003 02:53 AM



All times are GMT -4. The time now is 05:12 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc