[xsl] Re:

Subject: [xsl] Re:
From: "bix xslt" <bix_xslt@xxxxxxxxxxx>
Date: Wed, 05 Mar 2003 22:37:08 +0000

James,


Try using the following syntax:
<xsl:stylesheet version="1.1"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 .
 .
 .
 <xsl:value-of select="$variableName/path/to/node"/>

alternatively (assuming just the end node was captured in the variable) use:
 <xsl:value-of select="$variableName"/>

In your instance, you might have something similar to the following:

<xsl:value-of select="$newDate/General/AccessedDate"/>

Without seeing your xsl file, it is difficult to know if newDate contains a node fragment starting at FileInformation or the final node, AccessedDate. If it is a node fragment, you will probably want to use xslt version 1.1 as it allows for node fragment accessing without an extension function. Otherwise, you'll need to use an extension function within your xml processor. An example of this is:

<x:stylesheet version="1.0"
 xmlns:x="http://www.w3.org/1999/XSL/Transform";
 xmlns:m="urn:schemas-microsoft-com:xslt">
 .
 .
 .
 <x:value-of select="m:node-set($newDate)/General/AccessedDate"/>

Hope that helps!
bix

From: "Pilarski,James" <James.Pilarski@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: "XSL-List (E-mail)" <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 3 Mar 2003 11:31:48 -0600

I was wondering if somebody could answer a question for me. I have the following XML file:

<?xml version="1.0" encoding="UTF-8"?>
<FileInformation>
	<General CreationDate="2003-01-01">
		<AccessedDate ModifiedDate="2003-02-14">2003-03-17</AccessedDate>
		<System>TRS80</System>
	</General>
</FileInformation>

Currently, I am using XSL to display the information in a table in HTML in a web browser. Until now the system that generates the XML was updating everything perfectly. This will be fixed in the future but for now I was wondering if there was any way for me to change the text in the <AccessedDate> element without effecting any of the other elements or attributes. Unfortunately, the current system's structure does not allow me to transform the XML, save, and redisplay it in the browser. What I need to do is get the new Accessed Date from another node in the XML (I have assigned this to a variable already, $NewDate) and set the <AccessedDate> element equal to the $NewDate variable. So if the new Accessed Date in the date variable is 2003-12-25, I would want the XML to look like this:

<?xml version="1.0" encoding="UTF-8"?>
<FileInformation>
	<General CreationDate="2003-01-01">
		<AccessedDate ModifiedDate="2003-02-14">2003-12-25</AccessedDate>
		<System>TRS80</System>
	</General>
</FileInformation>

I am pretty new to XSL but I do not think this is possible without an outright transformation.

Thanks,
Jim


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread
  • [xsl] Re:
    • bix xslt - Wed, 05 Mar 2003 22:37:08 +0000 <=