473,970 Members | 21,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to have the style sheet included in the sqame file as the XML data

RD
My app transmits XML data file via e-mail and for now I attach both the XML
data file and the corresponding style sheet. I found however that whenthe
recipient double clicks on the XML file to read it, he/she can't open it
that way. For some reason that escapes me, the XSL fil can't be found,
although theoretically they bot are in the same folder. If user copies both
XML and XSL files to another same folder for both, then he/she can read XML
by double clicking on it and it finds its XSL OK.

Which behavioiur brings me to me question above. Is there a way to directly
embed the XSL in the XML file itself. I want to send tye data as XML to make
it easy for the recipient to devellop a method to import it in hois own
database and it needs to be as user friendly as possible when it commes to
viewing from the e-mail message, but the behaviour above makes it a bit hard
for recipient.

Any help or suggestions would be greatly appreciated.

Bob

Hope you all had a pleasant Christmas.
Nov 12 '05 #1
3 1391


RD wrote:

Is there a way to directly
embed the XSL in the XML file itself.


In theory you can do that, yes

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="#theSheet "?>
<root>
<xsl:styleshe et id="theSheet"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">
</xsl:stylesheet>
</root>

though to have that work you need to include a DTD that defines the id
attribute of the xsl:stylesheet element.

Details are here:
<http://www.w3.org/TR/xslt#section-Embedding-Stylesheets>

But as far as I remember MSXML used by IE doesn't support that.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Hello RD,

Instead of passing the XSL, why not just send the XML and also send an HTML
that is the result of applying the XSL to the XML. that way, the user does
not need to know anything about stylesheets, and the XML simply arrives as
an attachment like so many others they probably get.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"RD" <no****@nospam. net> wrote in message
news:u3******** *****@TK2MSFTNG P15.phx.gbl...
My app transmits XML data file via e-mail and for now I attach both the XML data file and the corresponding style sheet. I found however that whenthe
recipient double clicks on the XML file to read it, he/she can't open it
that way. For some reason that escapes me, the XSL fil can't be found,
although theoretically they bot are in the same folder. If user copies both XML and XSL files to another same folder for both, then he/she can read XML by double clicking on it and it finds its XSL OK.

Which behavioiur brings me to me question above. Is there a way to directly embed the XSL in the XML file itself. I want to send tye data as XML to make it easy for the recipient to devellop a method to import it in hois own
database and it needs to be as user friendly as possible when it commes to
viewing from the e-mail message, but the behaviour above makes it a bit hard for recipient.

Any help or suggestions would be greatly appreciated.

Bob

Hope you all had a pleasant Christmas.

Nov 12 '05 #3
I have a similar need. My users need the XML data for later import into
ACCESS or EXCEL. The need to be able to click on the attachment to see it,
and save it later.

I've gotten it to work, but have run into a formatting issue in the xsl
itself. Any input is appreciated.

Here are the original xml and xsl, which works fine.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test2.xsl "?>
<test>
<row>
<item>test item 1 </item>
</row>
<row>
<item>test item 2 </item>
</row>
<row>
<item>test item 3 </item>
</row>
<row>
<item>test item 4 </item>
</row>
<row>
<item>test item 5 </item>
</row>
</test>

Here is the original xsl:

<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:key name="kItem" match="row" use="item" />
<xsl:template match="/">
<HTML>
<HEAD>
<STYLE>
.HEADER { background-color:lightblue ;font-weight:bold }
.ITEMROW { background-color:beige;fon t-weight:bold }
</STYLE>
</HEAD>
<BODY>
<TABLE>
<COLGROUP WIDTH="200" ALIGN="LEFT" />
<TR>
<TD CLASS="HEADER"> Item</TD>
</TR>
<xsl:for-each
select="test/row[generate-id()=generate-id(key('kItem', item))]">
<COLGROUP WIDTH="200" ALIGN="LEFT" />
<TR>
<TD CLASS="ITEMROW" >
<xsl:value-of select="item" />
</TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
The above all works fine. When I combine the XML and XSL into a single file,
apparently the xsl:for-each does not work.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="#styleshe et"?>
<!DOCTYPE doc [
<!ATTLIST xsl:stylesheet
id ID #REQUIRED>
]>
<doc>
<xsl:styleshe et id="stylesheet " version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:key name="kItem" match="test/row" use="item" />
<xsl:template match="xsl:styl esheet" />
<HTML>
<HEAD>
<STYLE>
.HEADER { background-color:lightblue ;font-weight:bold }
.ITEMROW { background-color:beige;fon t-weight:bold }
</STYLE>
</HEAD>
<BODY>
<TABLE>
<COLGROUP WIDTH="200" ALIGN="LEFT" />
<TR>
<TD CLASS="HEADER"> Item</TD>
</TR>
<xsl:for-each
select="test/row[generate-id()=generate-id(key('kItem', item))]">
<COLGROUP WIDTH="200" ALIGN="LEFT" />
<TR>
<TD CLASS="ITEMROW" >
<xsl:value-of select="item" />
</TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:stylesheet>
<test>
<row>
<item>test item 1 </item>
</row>
<row>
<item>test item 2 </item>
</row>
<row>
<item>test item 3 </item>
</row>
<row>
<item>test item 4 </item>
</row>
<row>
<item>test item 5 </item>
</row>
</test>
</doc>

Thanks in advance to all the gurus out there.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2025
by: Mark | last post by:
Hi - I want to allow users of an intranet application, to select their own colours etc. So I have a tbale in my database, which has fields called bgcolour, fontcolour etc. As I want all pages to get the users colours, I have an includes file at the top of each page: <!--#include file="userconfig.asp" --> This is:
19
15633
by: Roger | last post by:
How can I pass parameters to a style sheet? I have noticed a couple of sites are now passing variables to the style sheet, which appear to be substituted at run time. For example: <link rel="stylesheet" type="text/css" href="mystyle.css?color=ffffff"> I have seen references in my temp Internet file directory that indicates this is possible, but I can't find any documentation how to do it.
3
2139
by: joealey2003 | last post by:
Hi all... I included a css file on my html and i need to check some properties. The html is: <style id="myid" src="mycsspage.css"> </style> Now i need something to access it like: alert(document.getElementById("myid").bottomline.color);
2
1163
by: Wade Beasley | last post by:
I have a web site I am working on for a client using ASP.NET with VB.Net for the language. The client decided they needed the ability to choose between different page layouts based on a setting in the database. I have the header and footer working correctly by using a custom base page and before the Page_Load loading the correct version from a subdirectory with the Layout Number as the directory name. Now what I need is the ability to...
2
1395
by: Matthew McDermott | last post by:
Hi, I am working on "reskinning" an application that uses style sheets. I have been editing the default stylesheets by adding my alterations to the bottom of the .css files. I was wondering if there was a way to add an "include" at the bottom of the existing stylesheets to point to another stylesheet, this would prevent my changes from being overwritten if the product upgrade overwrites the
1
1989
by: Amanda H. | last post by:
I posted about this a few days ago, and I got a few suggestions that fixed part of my problem. I am using a PHP script to switch external style sheets when the viewer clicks on the style link. Search "Amanda H." in this group and you can view my last post to see the original PHP and html junk. This below is the updated link rel and the meta tags. Before, it wouldn't refresh or change in Opera, Firefox, or IE6/Win & IE5/Mac. The...
8
41542
by: pamelafluente | last post by:
Hi guys, Is it possible to add "onload" (via Javascript) a new class to the <styleheader section? If yes, how would that be done ? <style type="text/css" media="screen"> .NewStyleClass{ whatever } </style>
1
1670
by: Looch | last post by:
Hi All, I have a need for a user to open an XML file from a web site and have it open based on a style sheet, not just looking at the raw XML data. I'm wondering what the best way to go about this is... Do I download the style sheet to every PC that navigates to the web site in question? Would this use ActiveX?
5
1700
by: Gretsch | last post by:
After lots of problems trying to allow the visitor to switch styles using Javascript - but encountering browser incompatabilities!! I decided to use PHP and found a simple way of doing it here: http://www.geek-notes.com/css/23/cascading-style-sheet-switcher/ But it's not quite working ... could someone help me with the syntax please It consists of 4 parts: 1 - <link href=”/path/<?php echo $style ?>.css” rel=”stylesheet”...
0
10345
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11803
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
11553
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10065
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8449
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.