jbru
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by jbru
-
-
Okay, I think I solved it myself after a lot of trial and error. This seems to have done the trick:
<xsl:variable name="hostname" select="HostProperties/tag[@name='hostname']"/>
-
Hi, So I'm hoping to get some pointers on identifying namespaces and data contained within them. I have the task of transforming some (to my mind at least) unusual xml and I've not been able to successfully navigate it. Here's an example of the xml:
<Report><ReportHost name="SampleHostName"><HostProperties><tag name="End_Time">Fri Jul 30 16:14:56 2010</tag><tag name="mac-address">00:00:00:00:00:01</tag><tag name="os_name">Microsoft Windows</tag><tag name="hostname">TestHostname</tag><tag name="Start_Time">Fri Jul 30 16:13:51 2010</tag></HostProperties>...</ReportHost>...</Report>
And here is relevant portion of the XSLT that I'm trying to use to assign "TestHostname" to an XSLT variable:
<xsl:for-each select="Report/ReportHost"> <xsl:variable name="hostname" select="HostProperties/tag"/>
Running this, the variable "hostname" is assigned all the information (Fri Jul 30 16:14:56 2010 00:00:00:00:00:01 Microsoft Windows TestHostname Fri Jul 30 16:13:51 2010). If I run it with the select expression "HostProperties/hostname" it returns nothing. How can I assign the xslt variable "hostname" the relevant data that is held in
<tag name="hostname">TestHostname</tag>
? Unfortunately I haven't been able to find any information quite like this in any of the documentation or trainings I've seen.
namespace?
in XSLT/XSL-FO
Posted · Edited by jbru
Chiming in here because I have a similar problem.
My xml to be transformed is
I've added xmlns:cm="http://example.org" exactly as it is written to the stylesheet declarations as such
And my xslt code is
"var" is returned blank and I'm really at an impasse as to how to access this data.
damaq, you might find this helpful: http://w3schools.invisionzone.com/index.php?showtopic=48839&hl=namespace#entry270426