基于 cookie 存在的 XDV 条件
我想根据 cookie 条件创建 XDV 规则。
假设我有一个名为“mobile”的 cookie,如果它存在,我想删除一些样式表和脚本规则。
(顺便说一句,原型设计 plone.org 移动版)
I'd like to create XDV rules based on a cookie condition.
Let's say that I have a cookie called "mobile" and if it's present I want to delete some stylesheet and script rules.
(BTW prototyping plone.org mobile version)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
XDV / Diazo 支持标准 XSLT 参数,只需将: 添加
到
的顶层,然后您就可以在 if-content 表达式中使用$myvar
访问该值。目前只有 Nginx 提供了配置传入哪些参数的方法(参见 http://pypi.python。 org/pypi/xdv#nginx 作为传入 $path 参数的示例。)
Apache mod_tansform 模块不支持参数。我有一些半工作代码,但它需要获得 xpath 引用支持和更好的配置语法,然后才能将其合并到分布式 mod_transform 中。
我希望在 plone.app.theming (collective.xdv 的下一个版本)中看到 tal 表达式到参数映射,但我不知道什么时候才能实现它。不过它应该相当简单。
根据记录,我强烈反对添加允许在 xpath 中内联 tal 的 xslt 扩展。
不过,对于这个用例,我确实认为最好有一个单独的网络和移动域,正如您在 http://webandmobile.mfabrik.com/docs/web-and-mobile/user-manual/redirector ;)
XDV / Diazo supports standard XSLT parameters, just add:
to the top level of your
<rules>
and you can then access the value using$myvar
in if-content expressions.Currently only Nginx provides a way to configure which parameters are passed in (see http://pypi.python.org/pypi/xdv#nginx for an example where the $path parameter is passed in.)
The Apache mod_tansform module does not have parameter support. I had some half working code for it, but it needs to gain xpath quoting support and better configuration syntax before I can merge it into the distributed mod_transform.
I would like to see tal expression to parameter mapping in plone.app.theming (the next version of collective.xdv) but I don't know when I'll get to implement it. It should be fairly simple though.
For the record I'm strongly against adding xslt extensions that would allow inline tal in xpaths.
For this use case though, I do think it is better to have a separate web and mobile domain, as you indeed advocate at http://webandmobile.mfabrik.com/docs/web-and-mobile/user-manual/redirector ;)