<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon">
<xsl:output method="text" encoding="us-ascii"/>

<xsl:template match="/">
	<xsl:for-each select="tables/table">
	<saxon:output file="test.txt">
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END

Attribute VB_Name = "<xsl:value-of select="@tablename"/>"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit

'****************************************************
'* Section containing class variables
'****************************************************
<xsl:for-each select="child::fields/field">
    private mvar<xsl:apply-templates select="." mode="variable"/> As <xsl:apply-templates select="." mode="datatype"/>
    private mvar<xsl:apply-templates select="." mode="variable"/>Original As <xsl:apply-templates select="." mode="datatype"/>
</xsl:for-each>
    private mvarblnDeleted As Boolean

Private Sub Class_Initialize()
    mvarblnDeleted = False
End Sub

Public Sub SetDeleted(Optional ByVal blnswitch As Boolean = true)
    mvarblnDeleted = blnswitch 
End Sub

Public Function IsDeleted() As Boolean
    IsDeleted = mvarblnDeleted 
End Function 
<xsl:for-each select="child::fields/field">
Public Property Let <xsl:apply-templates select="." mode="variable"/>(ByVal vData As Long)
    mvar<xsl:apply-templates select="." mode="variable"/> = vData
End Property

Public Property Get <xsl:apply-templates select="." mode="variable"/>() As Long
    <xsl:apply-templates select="." mode="variable"/> = mvar<xsl:apply-templates select="." mode="variable"/>
End Property

Public Property Let <xsl:apply-templates select="." mode="variable"/>Original(ByVal vData As Long)
    mvar<xsl:apply-templates select="." mode="variable"/> = vData
End Property

Public Property Get <xsl:apply-templates select="." mode="variable"/>Original() As Long
    <xsl:apply-templates select="." mode="variable"/> = mvar<xsl:apply-templates select="." mode="variable"/>
End Property
</xsl:for-each>
</saxon:output>
</xsl:for-each>
</xsl:template>

<xsl:template match="field" mode="variable">
	<xsl:if test="@datatype='character'">str</xsl:if>
	<xsl:if test="@datatype='numeric' and @precision='0'">lng</xsl:if>
	<xsl:if test="@datatype='numeric' and @precision!='0'">dbl</xsl:if>
	<xsl:if test="@datatype='date'">dat</xsl:if>
	<xsl:value-of select="@fieldname"/>
</xsl:template>

<xsl:template match="field" mode="datatype">
	<xsl:if test="@datatype='character'">String</xsl:if>
	<xsl:if test="@datatype='numeric' and @precision='0'">Long</xsl:if>
	<xsl:if test="@datatype='numeric' and @precision!='0'">Double</xsl:if>
	<xsl:if test="@datatype='date'">Date</xsl:if>
</xsl:template>


</xsl:stylesheet>
