Subject: [xsl] Problem with "value-of" tags in XSLT to be placed at desired location in Text Output From: Jyotsna B <jbendapu@xxxxxxxxx> Date: Mon, 22 May 2006 12:15:17 -0700 (PDT) |
Hi All, I started new on XSLT project and learning and implementing in JAVA - XML- XSLT transformation Converting the XML file data into insert statement I have 2 Questions below .Appreciate any suggestions/help :- 1) These "value-of" tags in XSLT are not getting replaced by values in XML file at the place in wanted in Output <xsl:value-of select="/bea/weblogic-version"/>, I checked many examples but unable to figureout :-( How to achieve this Output from XML ,XSLT Transform by having xml values in between commas "," ? 2) How to get all 3 insert statements in the output(My current output is stuck after first insert staement .. not going back to XML file )? DETAILS WITH EXAMPLES BELOW:- Correct output should look like this -Aiming to get this output below -- -------------------- insert into server ( 'oracleAppVersion',java-version,java-vendor,java-vm-version,java-vm-vendor,java-vm-name,os-arch,os-name,os-version ) values ( 17T09:30:47.0Z,1.0 ,true ,1 ,2.01 ,wls ,bea ,bea-wls ,jdbc ); insert into jdbc-data ( datasource ,driver-name,database-product-version,database-product-name) values ( jdbc,2.0,1.1.1,orcl1 ); insert into jdbc-data ( datasource ,driver-name,database-product-version,database-product-name) values ( odbc,2.2.0,1.1.1,sybase); ------------ Wrong Ouput I am getting now ----------- 1)When I run XML file with XSLT , I am getting Output as below .I wanted the values to be replaced in between commas "," but they are pasted after the XSLT template output text . 2)And also I am getting Only one insert statement and doesnot go back to XML file for getting next 2 insert statements insert into server ( 'oracleAppVersion',java-version,java-vendor,java-vm-version,java-vm-vendor,java-vm-name,os-arch,os-name,os-version ) values ( , , , , , , , , ); 2001-12-17T09:30:47.0Z1.0true1.1.0bea5.0bea-wlswlswlsarchbeaos3.3jdbc2.01.1.1orcl --------- XSLT File:- ------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" > <xsl:output method="text" indent="yes"/> <xsl:template match="domain-name/server"> insert into server ( 'oracleAppVersion',java-version,java-vendor,java-vm-version,java-vm-vendor,java-vm-name,os-arch,os-name,os-version ) values ( <xsl:value-of select="/comp/weblogic-version"/>, <xsl:value-of select="/java/version"/>, <xsl:value-of select="java/vendor"/>, <xsl:value-of select="java/vm/version"/>, <xsl:value-of select="java/vm/vendor"/>, <xsl:value-of select="java/vm/name"/>, <xsl:value-of select="os/arch"/>, <xsl:value-of select="os/name"/>, <xsl:value-of select="os/version"/> ); </xsl:template> <xsl:template match="domain-name/jdbc-data"> insert into jdbc-data ( 'oracleAppVersion',java-version,java-vendor,java-vm-version,java-vm-vendor,java-vm-name,os-arch,os-name,os-version ) values ( <xsl:value-of select="/datasource/driver-name"/>, <xsl:value-of select="/datasource/database-product-version"/>, <xsl:value-of select="/datasource/database-product-name"/>, ); </xsl:template> </xsl:stylesheet> ------------- XML file : ------------ <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="file.xslt" type="text/xslt"?> <!--Sample XML file generated by XMLSpy v2006 sp1 U (http://www.altova.com)--> <inventory xmlns="http://xx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="String"> <domain-name>WLS</domain-name> <timestamp>2001-12-17T09:30:47.0Z</timestamp> <server is-admin-server="false" name="String"> <comp> <weblogic-version>1.0</weblogic-version> <production-mode-enabled>true</production-mode-enabled> <subsystem name="Text"/> <subsystem name="Text"/> </comp> <java> <version>1.1.0</version> <vendor>bea</vendor> <vm> <version>5.0</version> <vendor>bea-wls</vendor> <name>wls</name> </vm> </java> <os> <arch>wlsarch</arch> <name>beaos</name> <version>3.3</version> </os> </server> <jdbc-data> <datasource name="String"> <driver-name>jdbc</driver-name> <driver-version>2.0</driver-version> <database-product-version>1.1.1</database-product-version> <database-product-name>orcl</database-product-name> </datasource> </jdbc-data> <jdbc-data> <datasource name="String"> <driver-name>odbc</driver-name> <driver-version>2.2.0</driver-version> <database-product-version>1.1.1</database-product-version> <database-product-name>sybase</database-product-name> </datasource> </jdbc-data> </inventory> Any help is greatly appreciated Jyotsna __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [ XSLT ] Dynamically Tran, Raffaele Sena | Thread | Re: [xsl] Problem with "value-of" t, Jagdishwar B |
RE: [xsl] Evaluation of predicates , Buchcik, Kasimier | Date | Re: [xsl] Evaluation of predicates , bryan rasmussen |
Month |