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]

<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 &lt; 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
&lt; 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 &gt; 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 &gt; 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


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