Google Answers Logo
View Question
 
Q: XML and XSL ( No Answer,   0 Comments )
Question  
Subject: XML and XSL
Category: Computers > Internet
Asked by: corbob-ga
List Price: $4.00
Posted: 04 Sep 2002 05:05 PDT
Expires: 05 Sep 2002 14:46 PDT
Question ID: 61588
Is there a way to reference an XML file data via a XSL file?

For instance: I can reference the XSL file from the XML file with this
line
<?xml-stylesheet type="text/xsl" href="open.xsl"?> however, I want to
do the opposite.

Explaination: I have an XML data file that contains a listing of tasks
with status's of (open, closed, waiting), I created open.xsl,
closed.xsl, and waiting.xsl to list only work orders of those
status's. I want the .xsl files to pull data from the same XML data
file containing all tasks.

Request for Question Clarification by iaint-ga on 04 Sep 2002 05:09 PDT
Hi corbob

What program/software are you using to perform your XSLT process?
Usually you give the transformation program parameters including the
name of both the XSL and XML files to be used.

Clarification of Question by corbob-ga on 04 Sep 2002 05:20 PDT
Hello Iaint,

The XML file is generated by a program I wrote in SQR (just a
procedural language program nothing XML specific.)

The XSL program is just a 40 line file I wrote myself to make the
output nice, I'll paste it in:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head><title>Development Team Tasks</title></head>
<body bgcolor = 'white'> 

SMH002: Development Tasks Report 
<xsl:for-each select="DEVTASKS/TASK">
<xsl:sort select="ASSIGN"/>
<hr size="5"></hr>
<b>Assign: </b> <font color="#FF0000"> <xsl:value-of select="ASSIGN"/>
</font>

<b> Task ID: </b>
<A>
 <xsl:attribute name="href">mailto:helbing@uwplatt.edu?subject=<xsl:value-of
select="TASKID"/>
 </xsl:attribute>
 <xsl:value-of select="TASKID"/>
</A>

<b> Status: </b> <xsl:value-of select="STATUS"/>
<b> Priority: </b> <xsl:value-of select="PRIORITY"/>
<br><b>Customer: </b> <xsl:value-of select="CUSTOMER"/> </br>
<b> Phone: </b> <xsl:value-of select="PHONE"/>
<b> Email: </b>
<A>
 <xsl:attribute name="href">mailto:<xsl:value-of select="EMAIL"/>
 </xsl:attribute>
 <xsl:value-of select="EMAIL"/>
</A>

<br><b> Subject: </b> <xsl:value-of select="SUBJECT"/></br>
<br><b> Category: </b> PRODUCTION_ISSUE</br>
<br><br><xsl:value-of select="DESCR"/><br></br></br></br>

<xsl:for-each select="SEQUENCE">
<br><blockquote><b>Sequence: </b><xsl:value-of select="SEQID"/><b>
Date: </b> <xsl:value-of select="DATE"/><b> OPRID: </b> <xsl:value-of
select="OPRID"/> <br></br>
<xsl:value-of select="SEQDESCR"/></blockquote></br>
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

Request for Question Clarification by bryn-ga on 04 Sep 2002 06:52 PDT
Hi corbob

I think iaint was asking which XSLT processor you will be using to
parse the XSL and XML files.

For example, if you will be using the C++ version of Apache's Xalan,
then the following command would make it display your open tasks
(assuming tasks.xml is the name of your data file):

  xalan tasks.xml open.xsl

A different XSLT processor would probably require a different syntax,
although the pronciple would be the same.

Clarification of Question by corbob-ga on 04 Sep 2002 07:07 PDT
I'm displaying the results in a webpage...here's some examples

XML output with the XSL stylesheet
http://nw.uwplatt.edu/is/oit/development/task.xml

if you view the source you can see the plain XML and the reference to
the stylesheet here: 
http://nw.uwplatt.edu/is/oit/development/task.xsl

What I'd like to be able to do is open the task.xsl page and have it
reference the XML datafile, rather than the opposite, the XML
referencing the XSL datafile.

Here's an example of another stylesheet:
http://nw.uwplatt.edu/is/oit/development/waiting.xsl
--the only line different is this:  <xsl:for-each
select="DEVTASKS/TASK[STATUS='WAIT']">

Request for Question Clarification by bryn-ga on 04 Sep 2002 07:23 PDT
I don't think you can reference the XML file from the XSL file. In
order to achieve the effect you want, you will need to explicitly tell
your XSLT processor the names of both the XML and the XSL files you
want to process.

In your case the XSLT processor is your web-server, or an external
program that your web server is delegating XSLT processing to. Do you
know what web-server and/or XSLT program your system is running?

Clarification of Question by corbob-ga on 04 Sep 2002 10:53 PDT
>I don't think you can reference the XML file from the XSL file.

That's what i thought..isn't that odd though almost seems backwards.

>Do you know what web-server and/or XSLT program your system is
running?

I could have gone down the hall and asked..but a netcraft search
brings up that it's running a netware HTTP web server...that's what i
would have guessed too.

Clarification of Question by corbob-ga on 04 Sep 2002 11:01 PDT
If it isn't possible to reference XML from XSL is there any other
solution?  I don't need to use XSL i just thought that'd be the
easiest. I can't use PHP or Perl.

Request for Question Clarification by bryn-ga on 04 Sep 2002 12:30 PDT
XML/XSL certainly makes an elegant solution. If you could find out
more about the way your web-server handles XML/XSL you may still be
able to do it - I don't know anything about Netware servers, so I
can't offer any suggestions there.

If you can't use PHP or Perl, does that mean all CGI scripting
languages are a no-go?

What about using a Java applet? It might even be possible to do it
with JavaScript - possibly at some cost to your sanity!

Clarification of Question by corbob-ga on 04 Sep 2002 13:37 PDT
Worst case scenario I will just go with the XML files referencing the
XSL file, I don't think I want to open a can of Javascript for this,
as you say, my sanity is more important :) .

It's just odd to me that XML can reference XSL but not the other way
around...seems like there should be a fundamental solution.

For instance, Slashdot.org has an XML version of their website
(http://slashdot.org/slashdot.xml) wouldn't it be handy for someone to
be able to reference that with an XSL file on their own website to
display the data to their liking(on their own website)?  It would be
so quick and easy!  So strange it doesn't work that way??  I must be
missing something.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy