<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:variable name="YourNameSpace" select="'包名'"/>
  <xsl:variable name="YourTableName" select="'表格名称'"/>
  <xsl:variable name="YourTableRemark" select="'表格备注'"/>
  <xsl:variable name="YourClassName" select="'表格类名'"/>    
  <xsl:variable name="YourFieldFristKey" select="'主键字段名'"/>
  <xsl:variable name="YourFristKey" select="'主键属性名(主键属性名不同于主键字段名，前者有大小写之分，而后者没有)'"/>
  <xsl:variable name="YourDataTypeFristKey" select="'主键属性的数据类型(目标语言的数据类型如C#的int、string)'"/>
  <xsl:variable name="YourFieldFristTitle" select="'标题字段名(默认以第一个文本字段作为标题列和搜索列)'"/>  
  <xsl:variable name="YourAuthor" select="'作者'"/>
  <xsl:variable name="YourCreatDate" select="'创建日期'"/>
  <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
  <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
  <xsl:template match="/">

  /*-------------------------------------------------
  *文件名称：<xsl:copy-of select="$YourClassName"/>.java
  *创建人及日期：<xsl:copy-of select="$YourAuthor"/><xsl:text> </xsl:text><xsl:copy-of select="$YourCreatDate"/>
  *修改人、日期及内容:
  */-------------------------------------------------
  package <xsl:copy-of select="$YourNameSpace"/>.model;
import java.util.*;
import java.math.BigDecimal;
import java.io.Serializable;

class <xsl:copy-of select="$YourClassName"/> implements Serializable { 

  //成员
<xsl:for-each select="MengmaCodeHelper/Server/Database/Table[@Name=$YourTableName]/Column">
  private <xsl:value-of select="@TargetDatatype"/><xsl:text> </xsl:text><xsl:value-of select="@Property"/>      //<xsl:value-of select="@Caption"/>
</xsl:for-each>
    
  //构造函数
  public <xsl:copy-of select="$YourClassName"/>(){
  
  }  
  
  //GetSet对
 <xsl:for-each select="MengmaCodeHelper/Server/Database/Table[@Name=$YourTableName]/Column">
   //设置 <xsl:value-of select="@Caption"/>
 public <xsl:value-of select="@TargetDatatype"/><xsl:text> </xsl:text>set<xsl:value-of select="concat(translate(substring(@Property,1,1), $smallcase, $uppercase),substring(@Property,2))"/>(<xsl:value-of select="@TargetDatatype"/><xsl:text> </xsl:text><xsl:value-of select="@Property"/>){
    this.<xsl:value-of select="@Property"/> = <xsl:value-of select="@Property"/>;
   }
   // 获取 <xsl:value-of select="@Caption"/>
   public <xsl:value-of select="@TargetDatatype"/><xsl:text> </xsl:text>get<xsl:value-of select="concat(translate(substring(@Property,1,1), $smallcase, $uppercase),substring(@Property,2))"/>(){
    return this.<xsl:value-of select="@Property"/>;
   }
    
  </xsl:for-each>

 
} 
  </xsl:template> 
</xsl:stylesheet>