The xsl that would answer the question would have the following format:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema">
The template structure implementation depends on the way you would like to view the contents. My problem was to parse <rs:data> and <z:row> elements.
Thodoris.
Quote:
quote:Originally posted by Thodoris
I am new to XSLT and I am trying to apply an XSL transformation to an XML cutting a lot of stuff from the xml file.
The xml file follows:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:CommandTimeout='30'>
<s:AttributeType name='id' rs:number='1' rs:writeunknown='true'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='Brand' rs:number='2' rs:nullable='true' rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
</s:AttributeType>
<s:AttributeType name='model' rs:number='3' rs:nullable='true' rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
</s:AttributeType>
<s:AttributeType name='capacity' rs:number='4' rs:nullable='true' rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='50'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row id='1' Brand='Alfa Romeo' model='147' capacity='2.0'/>
<z:row id='2' Brand='Alfa Romeo' model='156' capacity='3.2'/>
<z:row id='3' Brand='Audi' model='A3' capacity='1.8T'/>
<z:row id='4' Brand='Audi' model='A4' capacity='2.5'/>
<z:row id='5' Brand='Citroen' model='C2' capacity='1.1'/>
<z:row id='6' Brand='Maserati' model='Quattroporte' capacity='3.0'/>
<z:row id='7' Brand='Volvo' model='S40' capacity='1.8'/>
</rs:data>
</xml>
and I am interested only to the data that are between the </rs:data> tags.
How would look an xsl file that would produce an xml output like the following?
<?xml version="1.0" encoding="iso-8859-7" standalone="yes" ?>
<rss version="0.91">
<channel>
<title>Help from p2p.wrox.com</title>
<link>NULL</link>
<description>A classification of car models</description>
<language>en</language>
<item>
<title>Alfa Romeo</title>
<link>NULL</link>
<description>147</description>
</item>
<item>
<title>Audi</title>
<link>NULL</link>
<description>A3</description>
</item>
<item>
<title>Citroen</title>
<link>NULL</link>
<description>C2</description>
</item>
</channel>
</rss>
|