xsl-list
[Top] [All Lists]

Changing the Value of Elements Using XSL

2003-03-03 11:00:07
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



<Prev in Thread] Current Thread [Next in Thread>
  • Changing the Value of Elements Using XSL, Pilarski,James <=