This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Confused with current context



something like this perhaps?

bash-2.01$ xt ado.xml ado2.xsl
<?xml version="1.0" encoding="utf-8"?>
<sample>
<firstname datatype="string" maxlength="20">Lee</firstname>
<surname datatype="string" maxlength="30">Barwick</surname>
<email datatype="string" maxlength="60">lee.barwick@metromail.co.uk</email>
<extension datatype="string" maxlength="4">05</extension>
<hols datatype="int" maxlength="4">14</hols>
</sample>





<xsl:stylesheet 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" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
exclude-result-prefixes="dt rs s z"
>

<xsl:output indent="yes"/>

	<xsl:template match="/">
		<sample>
			<xsl:apply-templates select="xml/rs:data/z:row/@*"/>
		</sample>
	</xsl:template>


	<xsl:template match="@*">
		<xsl:element name="{name()}">
		<xsl:variable name="fieldname" select="name()"/>
                <xsl:apply-templates select="
        //s:AttributeType[@name=$fieldname]/s:datatype/@dt:*"/>
           <xsl:value-of select="."/>
           </xsl:element>
	</xsl:template>


<xsl:template match="@dt:*"/>

<xsl:template match="@dt:type">
  <xsl:attribute name="datatype">
    <xsl:value-of select="."/>
  </xsl:attribute>
</xsl:template>

<xsl:template match="@dt:maxLength">
  <xsl:attribute name="maxlength">
    <xsl:value-of select="."/>
  </xsl:attribute>
</xsl:template>


</xsl:stylesheet>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]