[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl]
[xsl]
Subject: [xsl] <xsl:template match NOT WORKING
From: guru prasad <guruprasadv@xxxxxxxxx>
Date: Wed, 27 Jun 2001 02:35:19 -0700 (PDT)
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
Current Thread
- [xsl] <xsl:template match NOT WORKING
- guru prasad - Wed, 27 Jun 2001 02:35:19 -0700 (PDT) <=
- <Possible follow-ups>
- Oliver Becker - Wed, 27 Jun 2001 13:11:55 +0200 (MET DST)
<- Previous Index Next ->
RE: [xsl] Importing from database, Roger L. Cauvin
Thread
Re: [xsl] <xsl:template match NOT W, Oliver Becker
RE: [xsl] pls help me on XML-XSLt T, Michael Kay
Date
Re: [xsl] pls help me on XML-XSLt T, Rafael R. Sevilla
Month
Subject: [xsl] <xsl:template match NOT WORKING From: guru prasad <guruprasadv@xxxxxxxxx> Date: Wed, 27 Jun 2001 02:35:19 -0700 (PDT) |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Importing from database, Roger L. Cauvin | Thread | Re: [xsl] <xsl:template match NOT W, Oliver Becker |
RE: [xsl] pls help me on XML-XSLt T, Michael Kay | Date | Re: [xsl] pls help me on XML-XSLt T, Rafael R. Sevilla |
Month |