Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML and XSL all in one file

Status
Not open for further replies.

VBGuy2112

Programmer
Feb 19, 2002
58
US
Is there any way at all to have XSL and XML in the same document? I am trying to avoid having 2 separate files for the XML and XSL. Could someone give me an example of this? I have been searching and experimenting and can't get it to work.

Thanks in advance!!
 
No. Why on earth would you want to do this?

XSL is a language to transform XML to another form of XML. Transforming itself doesnt make any sense, why not just have the structure of XML you are trying to achieve there in the first place?

Jon
 
Yup, they need to be in separate files.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
I agree why would you want to...???

But technically, yes you could...

It would be possible to place 2 XML data islands in an HTML file... 1 would be the XML data, and the other the XSL data...

Then you could use DOM to preform the transformation...

But, that would completely eliminate the point of using XML in the first place...

the advantage of XML is to use your own tags to describe data... which can then be used to transfer data between databases, or serve as small independent databases, etc...

the advantage of using XSL is to be able to transform multiple XML files with one template...

if you put them both in one document, you might as well just use HTML...

Just out of curiosity...
Is there a specific reason you want to include them into one document?

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
A coworker of mine is actually working on this and he asked me if I knew a there was a way (since I had been waiting for something to do). He wants to send the xml in an email, so referencing another file isn't really feasible.

I understand this isn't typically the way to do things but you'd think there would be a way to do this. I'm guessing he wanted to avoid converting the xml to html everytime and he already had the xsl ready.
 
Why doesn't he put the following at the top of the XML:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="[URL unfurl="true"]http://www.my-xsl-is-here-check-it-out.com/myxsl.xsl"?>[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top