Feature detection in XSL template

V

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)?
 
M

Martin Honnen

VK said:
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.
 
A

Andy Dingley

VK said:
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)
 
V

VK

Andy Dingley said:
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>
 
A

Andy Dingley

VK said:
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.
 
V

VK

Andy Dingley said:
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 :)
 
N

notablyinclined

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.
 
V

VK

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.
 
J

Joe Kesselman

VK said:
"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.
 
N

notablyinclined

Sorry, should have quoted.

Email received from Andy Dingley - (e-mail address removed)

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: <[email protected]>
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" <[email protected]> Add to Address Book Add
Mobile Alert
To: (e-mail address removed)
Subject: Re:
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_7.19348907470703E-02"
Content-Length: 119763

What?
 
J

Joe Kesselman

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.
 
A

Andy Dingley

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. :cool:
 
A

Andy Dingley

Sorry, should have quoted.

Email received from Andy Dingley - (e-mail address removed)

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
 
J

Joe Kesselman

Andy said:
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.
 
A

Andy Dingley

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.
 
V

VK

Andy said:
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,002
Messages
2,570,258
Members
46,857
Latest member
ArleenWill

Latest Threads

Top