|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
reading xml file with path using functionHello there,
Following is my xslt , <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" /> <xsl:template match="*"> <xsl:variable name="docFilePath" select="concat('C:\test','\eka_db_config.xml')"/> <xsl:variable name="driver" select="document($docFilePath)/DB/JDBCClassName" /> <xsl:variable name="database" select="document('{$docFilePath}')/DB/JDBCURL" /> <test> <Path><xsl:value-of select="$docFilePath"/></Path> <JDBCURL> <xsl:value-of select="$database" /> </JDBCURL> </test> </xsl:template> </xsl:stylesheet> eka_db_config.xml file as follows , <?xml version="1.0"?> <DB> <JDBCURL>jdbc:oracle:thin:@ekaOracle1:1521:EKADBA2</JDBCURL> <JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName> <JDBCUserName>siddhu</JDBCUserName> <JDBCPassword>siddhu</JDBCPassword> </DB> When i execute transformation , I am not able to read xml file, Getting blank element. following output . <?xml version='1.0' ?> <test><Path>C:\test\eka_db_config.xml</Path><JDBCURL/></test> Don't know what i am doing wrong here . Please help me , regards Brijesh N K |
|
|
Re: how to reading xml file with path using functionFirstly, document() expects a URI, not a Windows filename. You want
file:///c:/.... Secondly, XPath expressions never contain curly braces. Change '{$docFilePath}' to $docFilePath. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: brijesh [mailto:brijeshnk@...] > Sent: 08 October 2009 15:12 > To: saxon-help@... > Subject: [saxon] how to reading xml file with path using function > > > Hello there, > Following is my xslt , > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="xml" /> > > <xsl:template match="*"> > <xsl:variable name="docFilePath" > select="concat('C:\test','\eka_db_config.xml')"/> > <xsl:variable name="driver" > > select="document($docFilePath)/DB/JDBCClassName" /> > <xsl:variable name="database" > > select="document('{$docFilePath}')/DB/JDBCURL" /> > <test> > <Path><xsl:value-of > select="$docFilePath"/></Path> > <JDBCURL> > <xsl:value-of select="$database" /> > </JDBCURL> > </test> > </xsl:template> > </xsl:stylesheet> > > eka_db_config.xml file as follows , > > <?xml version="1.0"?> > <DB> > <JDBCURL>jdbc:oracle:thin:@ekaOracle1:1521:EKADBA2</JDBCURL> > <JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName> > <JDBCUserName>siddhu</JDBCUserName> > <JDBCPassword>siddhu</JDBCPassword> > </DB> > > When i execute transformation , I am not able to read xml > file, Getting blank element. following output . > <?xml version='1.0' ?> > <test><Path>C:\test\eka_db_config.xml</Path><JDBCURL/></test> > > Don't know what i am doing wrong here . > Please help me , > > regards > Brijesh N K > -- > View this message in context: > http://www.nabble.com/how-to-reading--xml-file-with-path-using > Sent from the saxon-help mailing list archive at Nabble.com. > > > -------------------------------------------------------------- > ---------------- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. > Jumpstart your > developing skills, take BlackBerry mobile applications to > market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: how to reading xml file with path using functionthanks a lot Micahel , solved this issues by changing c:/ to file uri,
Regards Brijesh
|
| Free embeddable forum powered by Nabble | Forum Help |