I want to translate an XML file with data such as:
<FlatData>
<Details1_Collection>
<Details1 Customer1="Customer" Total1="3" />
...
</Details1_Collection>
</FlatData>
The data that interests me is the attributes and their values ββin each Details1. The problem is that these attributes will not necessarily be the same in every XML file I want to translate, and I want the general-purpose XSL to be able to process such Details1as these:
<Details1 Customer1="Customer" Total1="3" />
<Details1 Name="Jim" Age="14" Weight="180" />
<Details1 Date="2009-07-27" Range="1-5" Option1="True" />
These different ones Details1will not occur in the same XML source file, but in different files. However, I would like to use the same XSL on each.
I thought that I needed something like <xsl:value-of select="@attribute_name"/>, but what do I set for @attribute_name, when I do not know in advance what attributes will be? Also, how can I grab the attribute name? I would like to explode the original XML above, for example:
<Details1>
<Customer1>Customer</Customer1>
<Total1>3</Total1>
</Details1>
: ! :
<?xml version="1.0" encoding="UTF-8"?>
<FlatData>
<Details1_Collection></Details1_Collection>
</FlatData>
lavinio, JΓΆrn Horstmann , . :
msxsl.exe -o output.xml input.xml transform.xsl
, -, , namespace :
<Report Name="MyReport" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="MyReport">