471,075 Members | 724 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 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 1552


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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Old Wolf | last post: by
18 posts views Thread by Chris Travers | last post: by
22 posts views Thread by Luke Matuszewski | last post: by
7 posts views Thread by =?iso-8859-2?q?Seweryn_Habdank-Wojew=F3dzki?= | last post: by
4 posts views Thread by sjpolak | last post: by
10 posts views Thread by Conrad Lender | last post: by

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.