[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] <xsl:template match NOT WORKING
hai MY xml file: <ItemDetail> <Property> <Label>Dbms Data Type</Label> <PermanentName>S_LDD_DBMS_DATA_TYPE</PermanentName> <Value DataType="STRING">VARCHAR2</Value> </Property> <Property> <Label>Dbms Data Type Length</Label> <PermanentName>S_LDD_LEN</PermanentName> <Value DataType="INTEGER">1</Value> </Property> <Property> <Label>Data Storage Precision</Label> <PermanentName>S_LDD_PRECISION</PermanentName> <Value DataType="INTEGER">1</Value> </Property> <Property> <Label>Description</Label> <PermanentName>S_LDD_DESCR</PermanentName> <Value DataType="STRING">Data Type of Text Data Field</Value> </Property> </ItemDetail> <ItemDetail> <Property> <Label>Dbms Data Type</Label> <PermanentName>S_LDD_DBMS_DATA_TYPE</PermanentName> <Value DataType="STRING">NUMBER</Value> </Property> <Property> <Label>Dbms Data Type Length</Label> <PermanentName>S_LDD_LEN</PermanentName> <Value DataType="INTEGER">4</Value> </Property> <Property> <Label>Data Storage Precision</Label> <PermanentName>S_LDD_PRECISION</PermanentName> <Value DataType="INTEGER">0</Value> </Property> </ItemDetail> this is my xsl programme which has been succesfully compiled and executed <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:loop="http://informatik.hu-berlin.de/loop" version="1.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="ItemDetail"> <xsl:element name="ItemDetail"> <xsl:apply-templates select="Property"/> </xsl:element> </xsl:template> <xsl:template match="Property"> <xsl:choose> <xsl:when test="Value='NUMBER'"> <xsl:variable name="Length"> <xsl:value-of select="../Property[position()=2]/Value"/> </xsl:variable> <xsl:variable name="Precision"> <xsl:value-of select="../Property[position()=3]/Value"/> </xsl:variable> <xsl:element name="Property"> <xsl:copy-of select="./Label"/> <xsl:copy-of select="./PermanentName"/> <xsl:element name="Value"> <xsl:choose> <xsl:when test="($Length < 4 and $Precision=0)"> <xsl:attribute name="DataType"> <xsl:value-of select="./Value/@DataType"/> </xsl:attribute> <xsl:value-of select="'SMALL INTEGER'"/> </xsl:when> <xsl:when test="($Length >= 4 and $Length < 15 and $Precision=0)"> <xsl:attribute name="DataType"> <xsl:value-of select="./Value/@DataType"/> </xsl:attribute> <xsl:value-of select="'INTEGER'"/> </xsl:when> <xsl:when test="($Length > 15 and $Precision=0)"> <xsl:attribute name="DataType"> <xsl:value-of select="./Value/@DataType"/> </xsl:attribute> <xsl:value-of select="'BIGINT'"/> </xsl:when> <xsl:when test="($Length > 0 and ($Precision=1 or $Precision=2))"> <xsl:attribute name="DataType"> <xsl:value-of select="./Value/@DataType"/> </xsl:attribute> <xsl:value-of select="'DECIMAL'"/> </xsl:when> <xsl:otherwise> <xsl:attribute name="DataType"> <xsl:value-of select="./Value/@DataType"/> </xsl:attribute> <xsl:value-of select="./Value"/> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:copy-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> --------------------------------------------------------------------- <xsl:template match="Value[@DataType='STRING']/text()[.='VARCHAR2']"> <xsl:text>VARCHAR</xsl:text> </xsl:template> ---------------------------------------------------------------------- <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> my problem is that the part of code which is inbetween dotted lines is not executing whose main aim is to change <Value DataType="STRING">VARCHAR2</Value> to <Value DataType="STRING">VARCHAR</Value> cananybody solve it thanks guru __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|