Any XML Experts? Environment Variable Question
Discussion
I need to read Windows environment variables (e.g. TEMP folder location etc.) from an XML or XSLT document. Basically, I want one XML page to read another XML file for config settings (CONFIG.XML). This file is created by an application on startup and is written to a defined location (Windows TEMP location) - but this varies by user / machine and I need to "tell the XML page where to find it".
Any ideas appreciated...
Any ideas appreciated...
No, I want to use the environment variables in the XML file itself.
Like in VB, I might use something like
Dim XLocn
XLocn = %WIN_TEMP_PATH%£myfolder
where when the program ran, it might set XLocn to c:£temp£myfolder on one machine and c:£documents and settings£temp£myfolder on another.
The file CONFIG.XML holds info such as language selected, brands available etc and I need to use that information within another XML file.
Edit: backslashes removed by PH - changed them to "£"
>> Edited by miniman on Friday 16th April 10:56
Like in VB, I might use something like
Dim XLocn
XLocn = %WIN_TEMP_PATH%£myfolder
where when the program ran, it might set XLocn to c:£temp£myfolder on one machine and c:£documents and settings£temp£myfolder on another.
The file CONFIG.XML holds info such as language selected, brands available etc and I need to use that information within another XML file.
Edit: backslashes removed by PH - changed them to "£"
>> Edited by miniman on Friday 16th April 10:56
If I've read you right, the file already exists but you just need to know how to find the TEMP folder for the current user.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/gettemppath.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/gettemppath.asp
Wouldn't have thought so. Essentially an XML document is simply a text file with fancy formatting. The clever bits need to be supplied by the application that reads and processes the file.
Therefore, if the XML file contains 'special' markers for things like the TEMP path, your program would need to spot these and translate them accordingly.
{clarification: I was replying to miniman, not Plotloss!}
>> Edited by pdV6 on Friday 16th April 11:08
Therefore, if the XML file contains 'special' markers for things like the TEMP path, your program would need to spot these and translate them accordingly.
{clarification: I was replying to miniman, not Plotloss!}
>> Edited by pdV6 on Friday 16th April 11:08
miniman said:
Sorry, I'm not being clear. It's in XSL rather than XML. Here is the command:
xsl:when test="document('../../../../Config.xml')//Language='CF'"
Config.XML is stored in the Temp Path. I effectively want to do:
xsl:when test="document('$WINTEMPPATH$/Config.xml')//Language='CF'"
What you would have to do is set up an XML file using something like VB which would write a line into the xml, something like :
<VARIABLES>
<COMPUTERNAME Value="XXXXXX">
</VARIABLE>
Then in the xsl create a variable which will read this out of the xml file for use:-
<xsl:variable name="computername" select="//COMPUTERNAME/@Value"/>
you can then use this variable in the xsl sheet:
<xsl:when test="Something=$computername"
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


