473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Feature detection in XSL template

VK
Is there any possibility to detect any of UA's feature in the template?

I have an XML data file with XSL template linked having HTML page as
output. I would love to make some adjustments during the transformation
depending on target UA, say add xmlns:v="urn:schemas-microsoft-com:vml"
to html element for IE.

Or XSLT transformer exludes such option as such (only resulting
documents gets on hold of the environment)?

May 23 '06 #1
17 1686


VK wrote:
Is there any possibility to detect any of UA's feature in the template?


You can detect the XSLT processor in XSLT using
<http://www.w3.org/TR/xslt#function-system-property>
e.g.
<xsl:if test="system-property('xsl:vendor') = 'Microsoft'">

By now however there are several XSLT processor products from Microsoft,
several MSXML versions (3, 4, 5, 6) and two .NET versions (XslTransform,
XslCompiledTransform) so simply checking the vendor might not tell you
enough.
--

Martin Honnen
http://JavaScript.FAQTs.com/
May 23 '06 #2

VK wrote:
Is there any possibility to detect any of UA's feature in the template?


No, test for them outside the XSLT-processor and pass a flag into the
stylesheet.

This is a good approach (particularly with the M$oft tools under ASP)
because it still lets you cache loading the (slow) stylesheet and just
repeat the (quick) transformation as needed.

Don't make the mistake of assuming that testing for features of the
XSLT processor (which you can certainly do) tells you anything about
the features of the final client viewing the output. That's only the
case for client-side transforms (at most)

May 23 '06 #3
VK

Martin Honnen wrote:
You can detect the XSLT processor in XSLT using
<http://www.w3.org/TR/xslt#function-system-property>
e.g.
<xsl:if test="system-property('xsl:vendor') = 'Microsoft'">


Aha! Great thanks!

May 23 '06 #4
VK

Andy Dingley <di*****@codesmiths.com> wrote:
VK wrote:
Is there any possibility to detect any of UA's feature in the template?
No, test for them outside the XSLT-processor and pass a flag into the
stylesheet.


I still prefer Martin's solution (if it works cross IE/Gecko)
Don't make the mistake of assuming that testing for features of the
XSLT processor (which you can certainly do) tells you anything about
the features of the final client viewing the output. That's only the
case for client-side transforms (at most)


This is exactly my case: all transformations will be made client-side,
the initial entry point is the pure transformer's data, like:
<http://www.geocities.com/schools_ring/tmp/demo01/index.xml>

May 23 '06 #5
VK wrote:
Andy Dingley <di*****@codesmiths.com> wrote:
VK wrote:
Is there any possibility to detect any of UA's feature in the template?


No, test for them outside the XSLT-processor and pass a flag into the
stylesheet.


I still prefer Martin's solution (if it works cross IE/Gecko)


The problem with that is that it only tells you "where you are", once
you've arrived there. If your intention is to serve text/html output
vs. application/xml (or a variant), then by the time you make this
test, you've already completed the HTTP transfer and its headers.

As "All XSLT 1.0 processors are basically equal" (to an amazingly
consistent level for any multi-vendor software product) then you're
left with the question _why_ you'd want to test and discover which
processor you're running under. There's a very narrow window left to
you between "It's too late to do anything about it" and "It doesn't
matter anyway".

I certainly wouldn't build code on the lines of "If I'm running under
XSLT processor <foo>, then assume that DOM feature <bar> is usable".
That's very far from maintainable over time and this is an area
historically of great instability.

May 23 '06 #6
VK

Andy Dingley <di*****@codesmiths.com> wrote:
VK wrote:
I still prefer Martin's solution (if it works cross IE/Gecko)


The problem with that is that it only tells you "where you are", once
you've arrived there. If your intention is to serve text/html output
vs. application/xml (or a variant), then by the time you make this
test, you've already completed the HTTP transfer and its headers.


Sorry to say, but I'm not working with XHTML: first of all I don't like
it, secondly it is just not not supported enough to bother with
alternative solution. I'm using the HTML 4.01 Transitional (see the
link in the previous post). I just need some runtime template
adjustment, mainly in declared namespaces for IE. The first one is VML
namespace (counterpaired with SVG in Gecko/Opera 9 Beta). That could be
scripted over document.namespaces.add later, but why to patch something
later if it can be done on place? The second issue (that was the actual
reason of my post) is the anonymous content. While XBL allows to use
anonymous content on any element, Microsoft Viewlink requires to
pre-declare custom elements in a separate namespace. Doing all this
afterwards over scripting gets too messy and unreliable.

And yes, I know the next arguments - "so use only universally supported
features" :-) Thanks for advise (if it was ment), but with the same
success it can be applied to XSLT itself :-)

May 23 '06 #7
I received a virus (which only an idiot would have opened) in a email
from your account at codesmiths.com.

You should be aware of this.

May 23 '06 #8
VK

no*************@yahoo.com wrote:
I received a virus (which only an idiot would have opened) in a email
from your account at codesmiths.com.

You should be aware of this.


"You" means who? Please quote who you are replying to.

May 23 '06 #9
VK wrote:
You should be aware of this.

"You" means who? Please quote who you are replying to.


Note too that viruses routinely falsify their sending address. Unless
you've examined the headers in enough detail to guard against that,
you're probably wasting time by reporting 'em, since you're probably
sending mail to the wrong person.
May 23 '06 #10
Sorry, should have quoted.

Email received from Andy Dingley - di*****@codesmiths.com

Yes, I know addys can be faked, but I wanted to let this person know so
that they were aware; either they are sending virus, someone hacked
into their account or someone is using their info. in fake addys.

Info. below:

X-YahooFilteredBulk: 202.177.166.113
X-Originating-IP: [202.177.166.113]
Return-Path: <di*****@codesmiths.com>
Authentication-Results: mta112.mail.re4.yahoo.com from=codesmiths.com;
domainkeys=neutral (no sig)
Received: from 202.177.166.113 (HELO internet) (202.177.166.113) by
mta112.mail.re4.yahoo.com with SMTP; Mon, 22 May 2006 22:14:33 -0700
From: "dingbat" <di*****@codesmiths.com> Add to Address Book Add
Mobile Alert
To: no*************@yahoo.com
Subject: Re:
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_7.19348907470703E-02"
Content-Length: 119763

What?

May 23 '06 #11
no*************@yahoo.com wrote:
Yes, I know addys can be faked, but I wanted to let this person know so
that they were aware; either they are sending virus, someone hacked
into their account or someone is using their info. in fake addys.


Almost certainly the last, which means there's nothing they can do about
it. Happens to all of us eventually. Will continue to happen until
there's a consensus to migrate to a more secure mail system; the one
we've been using was never intended to survive this long or to survive
this much abuse.
May 23 '06 #12

no*************@yahoo.com wrote:
I received a virus (which only an idiot would have opened) in a email
from your account at codesmiths.com.


I'm sorry for your trouble, but I suggest you look up the definition of
"Joe jobbing" and other various forms of forgery, sporgery and sporks.
You almost certainly received some random spam from Elbonia, with a
forged header to look like one of ours.

I can assure you that codesmiths.com does not send out spam, trojans or
viruses (we don't even send out HTML encoded email). If you'd care to
forward the beastie to me (with its headers), I'll endeavour to point
you at where it really came from.

Anyway, given the number of viruses I get sent from Yahoo addresses, I
think we're about even. 8-)

May 23 '06 #13
On 23 May 2006 07:58:25 -0700, no*************@yahoo.com wrote:
Sorry, should have quoted.

Email received from Andy Dingley - di*****@codesmiths.com

Yes, I know addys can be faked, but I wanted to let this person know so
that they were aware; either they are sending virus, someone hacked
into their account or someone is using their info. in fake addys.


I can assure you that none of our email gets routed through Indian ISPs
like sify.net It's a simple faked header from a randomly leeched
usenet post. It's no more my email than the voices in George Bush's head
are really God talking to him.
If you want to hassle Sifycorp for being either a spamhaus or having
poor security, then here you go

Satyam Infoway Limited
Tidel Park,2nd Floor
4,Canal Bank Road,Taramani
Chennai, Tamilnadu 600113
IN
Phone: +91-44-22540770
Fax: +91-44-22540771
--
Die Gotterspammerung - Junkmail of the Gods
May 23 '06 #14
Andy Dingley wrote:
If you want to hassle Sifycorp for being either a spamhaus or having
poor security


Odds are that it's a worm which is scavenging it's victim's mail and
newsgroup logs for IDs to (a) pester and (b) claim to be from. In which
case, it isn't really Sify's fault either; it's one infected customer.
They may be able to track that individual down and get them to clean
their system, which would be a Good Thing... but it's a drop in the bucket.

Further discussion should probably be taken to one of the
security-related newsgroups. We certainly can't fix it here.

Move to close debate.
May 23 '06 #15
On 23 May 2006 07:02:50 -0700, "VK" <sc**********@yahoo.com> wrote:
Sorry to say, but I'm not working with XHTML: first of all I don't like
it, secondly it is just not not supported enough to bother with
In what way is "XHTML not supported" for XHTML that's being generated on
the client, by a client-side XSLT transform ? You're already limiting
yourself to only those browsers that do client-side XSLT.

I'm using the HTML 4.01 Transitional (see the
link in the previous post). I just need some runtime template
adjustment, mainly in declared namespaces for IE. The first one is VML
namespace (counterpaired with SVG in Gecko/Opera 9 Beta).


HTML is SGML, so no namespaces. You can cook yourself up some bogosity
that might even work on some browsers, but don't fool yourself that it's
a namespace.

May 23 '06 #16
VK

Andy Dingley wrote:
HTML is SGML, so no namespaces. You can cook yourself up some bogosity
that might even work on some browsers, but don't fool yourself that it's
a namespace.


That what W3C wants to make you to believe to push XHTML on :-)

HTML has default namespace which is (surprise! :-) html

You can use any other namespaces supported by UA or imported.

see
<http://developer.mozilla.org/en/docs/XBL:XBL_1.0_Reference#Example_-_Sticky_Notes>
and the sample itself at <http://www.nskom.com/external/xbl/notes.html>

May 24 '06 #17
Sorry Andy...long story. Suffice it to say, you are not to blame in
any way :-)

Anyway, given the number of viruses I get sent from Yahoo addresses, I
think we're about even. 8-)


May 25 '06 #18

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

Similar topics

2
by: Old Wolf | last post by:
I have code like this: template<typename T> T convert_string (std::string const &s) { std::istringstream iss(s); T t; iss >> t; return t; }
18
by: Chris Travers | last post by:
Hi all; I have been looking into how to ensure that synchronous replication, etc. could best be implimented. To date, I see only two options: incorporate the replication code into the database...
22
by: Luke Matuszewski | last post by:
We all know that feature detection technique works from very beggining of user-agents supporting JavaScript. We can alway check if eg. document has a write property or smth else: ...
2
by: petermichaux | last post by:
Hi, I don't know if there is a way to feature detect for this or not. I have a list and the user can click on items to select. I would like that they can command-click on Mac or control-click on...
10
by: petermichaux | last post by:
Hi, I'm picking apart the Yahoo! UI event.js library and stripping it down to just what I need. I'm also trying to make the parts I use better. I'm stumped on how to fix the code for the...
5
by: Gianni Mariani | last post by:
I'm hoping someone can tell me why using member address of works and why using the dot operator does not in the code below. The code below uses the template function resolution mechanism to...
7
by: =?iso-8859-2?q?Seweryn_Habdank-Wojew=F3dzki?= | last post by:
Hi There is an example of the code below (mostly written by P. Bindels). In that example is strongly highlighted that very important is the sequence of compiled code. In C++ could be assume...
4
by: sjpolak | last post by:
sorry, I put the original text instead of my changed one in the previous mail sorry hello, I am new to this forum and a laymen. I have awebsite www.earlyflute.com. I make baroque flutes as you...
10
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.