| | |
How to get exact xml file name
Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 20
Reputation:
Solved Threads: 0
Hi,
************************************************
Below is my xml code
************************************************
Below is my xslt code
************************************************
Getting output
D:\test\Checking.dita
Instead of this it should display only
"Checking"
************************************************
Scenario
1] I need file name to generate the HTML file.
2] Level of folder may vary. [File should be in any folder on drive.]
Please suggest.
Cheers,
Mahesh
************************************************
Below is my xml code
<?xml version="1.0" encoding="UTF-8"?> <concept><title>TEST</title><body><title>CHECKING</title></body></concept>
Below is my xslt code
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <xsl:for-each select="concept"> <xsl:variable name="filename1"><xsl:value-of select="base-uri()" /></xsl:variable> <xsl:value-of select="$filename1" /> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Getting output
D:\test\Checking.dita
Instead of this it should display only
"Checking"
************************************************
Scenario
1] I need file name to generate the HTML file.
2] Level of folder may vary. [File should be in any folder on drive.]
Please suggest.
Cheers,
Mahesh
•
•
Join Date: Oct 2008
Posts: 20
Reputation:
Solved Threads: 0
Hi Everybody,
I tried lot and finally get the solution for the same.
Which give the exact name of file.
Also it full fills the my condition
1] Level of folder may vary. [File should be in any folder on drive.]
please see modified code below...
If anyone has another idea on this please suggest.
Thanks.
Cheers,
Mahesh
I tried lot and finally get the solution for the same.
Which give the exact name of file.
Also it full fills the my condition
1] Level of folder may vary. [File should be in any folder on drive.]
please see modified code below...
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <xsl:text><![CDATA[ ]]> </xsl:text> <test><xsl:text><![CDATA[ ]]> </xsl:text> <xsl:for-each select="concept"> <xsl:variable name="filename1"><xsl:value-of select="base-uri()" /></xsl:variable> <p><xsl:call-template name="name"> <xsl:with-param name="id"><xsl:value-of select="$filename1" /></xsl:with-param> </xsl:call-template> </p> </xsl:for-each> <xsl:text><![CDATA[ ]]></xsl:text> </test> </xsl:template> <xsl:template name="name"> <xsl:param name="id" /> <xsl:choose> <xsl:when test="$id[contains(.,'\')]"> <xsl:call-template name="name"><xsl:with-param name="id"><xsl:value-of select="substring-after($id, '\')" /></xsl:with-param></xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-before($id, '.')" /> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
If anyone has another idea on this please suggest.
Thanks.
Cheers,
Mahesh
![]() |
Similar Threads
- How to Read XML file and to add some information into it (Visual Basic 4 / 5 / 6)
- Hidden characters (linebreaks) in string? (ASP.NET)
- Sql Server generated Web Links result in "Page cannot be found" (ASP)
- Xml & Ado.net (VB.NET)
- Open In New Window Php (PHP)
- Convent css template to joomla template (HTML and CSS)
- What exactly is xml? (RSS, Web Services and SOAP)
- vBulletin mod_rewrite for vB 3.0.7 (Existing Scripts)
- Reading from a file to fill an array (Java)
- saving xml file from servlet request instance (Java)
Other Threads in the XML, XSLT and XPATH Forum
- Previous Thread: PLMXML to generic xml
- Next Thread: Retrieve XML in HTML ?
| Thread Tools | Search this Thread |
api blogger blogging code delete development dynamiccreationofnvariablesinxslt error firstthreecharacterofastringrequired flipbook gdata google html include java link linspire linux microsoft news node openoffice overwrite precedence programming rss standards swf template transform variable w3c web xml xmlnotloading xmlonserver xsl xslt





