• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Global Variable from another xml

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I have a xml document as below which is broken at the moment becasue of global variable related problem. I am trying to allocate a global variable on the fly thorugh java. Varibale called "prodid" takes "file_path" and "xml_dir" to call "index.xml" doc from the specified values from java. The problem I might be facing is when I call document for indexdoc variable, ti looks for "index.doc" document in xsl document's parent directory. This tells me that at this point file_path and xml_dir are not allocated values.
I hope this makes sense, If not then please let me know so that we can resolve this. Basically I don't want to give absolute path to indexdoc variable. The path will be the same as concat($fle_path, $xml_dir).
Here is my XML:
+++++++++++++++++++
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
Document : File_Systems
Created on : 21 February 2002
Author : nilesh
Comment
purpose of transformation follows.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xalan="http://xml.apache.org/xalan"
exclude-result-prefixes="xalan"
>
<xsl utput method="html" version="4.0" encoding="iso-8859-1" indent="yes" />

<xsl aram name="file_path"/>
<xsl aram name="xml_dir"/>
<xsl aram name="xsl_dir"/>
<xsl aram name="html_dir"/>

<xsl:variable name="indexdoc" select="document(concat(file_path, xml_dir, 'index.xml'))"/>

<xsl:variable name="prodid" select="$indexdoc/root/@productID"/>


<xsl:template match="root">
<html>
<head>
<link rel="stylesheet" type="text/css">
<xsl:attribute name="href">
<xsl:text>../css_data/</xsl:text>
<xsl:value-of select="$prodid " />
<xsl:text>.css</xsl:text>
</xsl:attribute>
</link>
.........................
</xsl:stylesheet>
Thanks in advance
Nilesh Patel
 
NILESH PATEL
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Folks,
My fault. I should have put indexdoc varaible line like this, which I missed.
<xsl:variable name="indexdoc" select="document(concat($file_path, $xml_dir, 'index.xml'))"/>
It works now
Thanks and sorry
Nilesh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic