Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old September 22nd, 2005, 12:01 PM
Registered User
 
Join Date: Sep 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transform data does not change

I have a xsl doc that needs to loop through the xml and output a set of instructions it has to go sequentialy as if I was telling you what to do. My problem is that when the same thing has to get done again, but a little different twist, it only outputs the last instruction it transformed as many times as it occurs in the document.

What is the deal with that? and or how do you empty the buffer in between instruction? or is there a better way to fix it.

here is an example of my xsl sheet named MyxslSheet.xsl
-------------------------------*********************
<?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="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<h2 align="center">My Instructions For You</h2>
<xsl:for-each select="//step">
<xsl:choose>
<xsl:when test="defaults">
<p align="center">
<xsl:value-of select="//description"/>
</p>
<br/>
</xsl:when>
<xsl:otherwise>

<b>
<xsl:number value="position()-1" format="71000. "/>
</b>

</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="instruction1">

<b>instruction 1</b>

<br/>
<xsl:value-of select="//instruction1/description"/>
<br/>[list]
<li>
<xsl:value-of select="//instruction1/drive"/>
<xsl:value-of select="//instruction1/location"/>
</li>
</ul>
</xsl:when>
<xsl:when test="instruction2">

<b>instruction 2</b>

<br/>
<xsl:value-of select="//instruction2/description"/>
<br/>[list]
<li>
<xsl:value-of select="//instruction2/drive"/>
<xsl:value-of select="//instruction2/location"/>
</li>
</ul>
</xsl:when>
<xsl:when test="instruction3">

<b>instruction 3</b>

<br/>
<xsl:value-of select="//instruction3/description"/>
<br/>[list]
<li>
<xsl:value-of select="//instruction3/drive"/>
<xsl:value-of select="//instruction3/location"/>
</li>
</ul>
</xsl:when>
<xsl:when test="instruction4">

<b>instruction 4</b>

<br/>
<xsl:value-of select="//instruction4/description"/>
<br/>[list]
<li>
<xsl:value-of select="//instruction4/drive"/>
<xsl:value-of select="//instruction4/location"/>
</li>
</ul>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<br/>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-------------------------------*******


Here is a example of my xsl name instructions.xml
-------------------------------********
<?xml-stylesheet type="text/xsl" href="MyxslSheet.xsl"?>
<instructions requestid="UserName">
<step type="defaults">
<defaults>
<description>This is the title of the document</description>
</defaults>
</step>
<step type="instruction1">
<instruction1>
<description>This is instruction 1</description>
<drive>c:</drive>
<location>\MyDirectory</location>
</instruction1>
</step>
<step type="instruction2">
<instruction2>
<description>This is instruction 2</description>
<drive>A:</drive>
<location>\ThisDirectory</location>
</instruction2>
</step>
<step type="instruction3">
<instruction3>
<description>This is instruction 3</description>
<drive>a:</drive>
<location>\ThisDirectory2</location>
</instruction3>
</step>
<step type="instruction3">
<instruction3>
<description>This is instruction again </description>
<drive>a:</drive>
<location>\ThisDirectory4</location>
</instruction3>
</step>
<step type="instruction3">
<instruction3>
<description>This is instruction 1 again and agian</description>
<drive>a:</drive>
<location>\ThisDirectory5</location>
</instruction3>
</step>
<step type="instruction4">
<instruction4>
<description>This is instruction 4</description>
<drive>D:</drive>
<location>\ThatDirectory</location>
</instruction4>
</step>
</instructions>
------------------------------*********

thanks in advance
Vince.Stanzione






Similar Threads
Thread Thread Starter Forum Replies Last Post
base 64 data in transform golddog XSLT 4 September 14th, 2007 08:39 AM
Transform "loosely" related data to "tightly" jimmyjames1991 XSLT 3 May 23rd, 2007 10:53 AM
Transform Data Task Hide's tables Hal Levy SQL Server DTS 1 April 26th, 2005 11:36 PM
DTS Transform Data Task VB Script problem jan.aitken SQL Server DTS 0 May 28th, 2004 08:13 AM
How can XSL transform XHTML data into fragments? lamwh XSLT 0 April 19th, 2004 10:15 AM





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