|
|
 |
| 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.
|
 |

November 6th, 2009, 11:38 AM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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?
|

November 6th, 2009, 11:42 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Location: Germany
Posts: 655
Thanks: 0
Thanked 98 Times in 97 Posts
|
|
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
|

November 6th, 2009, 02:38 PM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
"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.
|

November 6th, 2009, 02:44 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2007
Location: Germany
Posts: 655
Thanks: 0
Thanked 98 Times in 97 Posts
|
|
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
|
|
The Following User Says Thank You to Martin Honnen For This Useful Post:
|
|

November 9th, 2009, 04:29 PM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
thanks for the help
Thanks for the advice.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |