非常教程

Nginx参考手册

ngx_http_xslt_module

ngx_http_xslt_module

  • 示例配置
  • 指令
  • xml_entities
  • xslt_last_modified
  • xslt_param
  • xslt_string_param
  • xslt_stylesheet
  • xslt_types

ngx_http_xslt_module(0.7.8+)是使用一个或多个XSLT样式表将XML响应的滤波器。

该模块不是默认生成的,它应该使用--with-http_xslt_module配置参数启用。

该模块需要libxml2和libxslt库。

示例配置

location / {
    xml_entities    /site/dtd/entities.dtd;
    xslt_stylesheet /site/xslt/one.xslt param=value;
    xslt_stylesheet /site/xslt/two.xslt;
}

指令

句法:

xml_entities路径;

默认:

语境:

http,服务器,位置

指定声明字符实体的DTD文件。该文件在配置阶段进行编译。由于技术原因,模块无法使用在已处理的XML中声明的外部子集,因此它将被忽略,而是使用专门定义的文件。这个文件不应该描述XML结构。例如,声明所需的字符实体就足够了:

<!ENTITY nbsp "&#xa0;">

句法:

xslt_last_modified on | 关闭;

默认:

xslt_last_modified关闭;

语境:

http,服务器,位置

允许在XSLT转换期间保留来自原始响应的“Last-Modified”标题字段以促进响应缓存。

默认情况下,由于响应的内容在变换过程中被修改,因此标题字段被删除,并且可能包含动态生成的元素或与原始响应无关地更改的部分。

句法:

xslt_param参数值;

默认:

语境:

http,服务器,位置

定义XSLT样式表的参数。将value被视为一个XPath表达式。该value可以包含变量。要将字符串值传递给样式表,可以使用xslt_string_param指令。

可能有几个xslt_param指令。当且仅当xslt_param当前级别上没有定义和xslt_string_param指令时,这些指令才从前一级继承。

句法:

xslt_string_param参数值;

默认:

语境:

http,服务器,位置

定义XSLT样式表的字符串参数。value不解释XPath表达式。该value可以包含变量。

可能有几个xslt_string_param指令。当且仅当xslt_string_param在当前级别上没有定义xslt_param和指令时,这些指令才从前一级继承。

句法:

xslt_stylesheet样式表参数=值...;

默认:

语境:

位置

定义XSLT样式表及其可选参数。样式表在配置阶段被编译。

参数可以单独指定,也可以使用“ :”分隔符分组在一行中。如果参数包含“ :”字符,则应该将其转义为“ %3A”。此外,还libxslt需要将包含非字母数字字符的参数括入单引号或双引号,例如:

param1='http%3A//www.example.com':param2=value2

参数描述可以包含变量,例如,可以从单个变量中获取整行参数:

location / {
    xslt_stylesheet /site/xslt/one.xslt
                    $arg_xslt_params
                    param1='$value1':param2=value2
                    param3=value3;
}

可以指定几个样式表。它们将按照指定的顺序依次应用。

句法:

xslt_types mime-type ...;

默认:

xslt_types text / xml;

语境:

http,服务器,位置

除了“ text/xml” 之外,还可以在指定的MIME类型的响应中启用转换。特殊值“ *”匹配任何MIME类型(0.8.29)。如果转换结果是HTML响应,则其MIME类型将更改为“ text/html”。

ngx_http_xslt_module
Nginx

Nginx是一款轻量级的 Web 服务器/反向代理服务器及电子邮件代理服务器,可在 BSD-like 协议下发行。其特点是占有内存少,并发能力强。

主页 https://nginx.org/
源码 http://hg.nginx.org/nginx
发布版本 1.13.6

Nginx目录

1.指南 | Guides
2.核心 | Core
3.ngx_google_perftools_module
4.ngx_http_access_module
5.ngx_http_addition_module
6.ngx_http_api_module
7.ngx_http_auth_basic_module
8.ngx_http_auth_jwt_module
9.ngx_http_auth_request_module
10.ngx_http_autoindex_module
11.ngx_http_browser_module
12.ngx_http_charset_module
13.ngx_http_core_module
14.ngx_http_dav_module
15.ngx_http_empty_gif_module
16.ngx_http_f4f_module
17.ngx_http_fastcgi_module
18.ngx_http_flv_module
19.ngx_http_geoip_module
20.ngx_http_geo_module
21.ngx_http_gunzip_module
22.ngx_http_gzip_module
23.ngx_http_gzip_static_module
24.ngx_http_headers_module
25.ngx_http_hls_module
26.ngx_http_image_filter_module
27.ngx_http_index_module
28.ngx_http_js_module
29.ngx_http_keyval_module
30.ngx_http_limit_conn_module
31.ngx_http_limit_req_module
32.ngx_http_log_module
33.ngx_http_map_module
34.ngx_http_memcached_module
35.ngx_http_mirror_module
36.ngx_http_mp4_module
37.ngx_http_perl_module
38.ngx_http_proxy_module
39.ngx_http_random_index_module
40.ngx_http_realip_module
41.ngx_http_referer_module
42.ngx_http_rewrite_module
43.ngx_http_scgi_module
44.ngx_http_secure_link_module
45.ngx_http_session_log_module
46.ngx_http_slice_module
47.ngx_http_spdy_module
48.ngx_http_split_clients_module
49.ngx_http_ssi_module
50.ngx_http_ssl_module
51.ngx_http_status_module
52.ngx_http_stub_status_module
53.ngx_http_sub_module
54.ngx_http_upstream_conf_module
55.ngx_http_upstream_hc_module
56.ngx_http_upstream_module
57.ngx_http_userid_module
58.ngx_http_uwsgi_module
59.ngx_http_v2_module
60.ngx_http_xslt_module
61.ngx_mail_auth_http_module
62.ngx_mail_core_module
63.ngx_mail_imap_module
64.ngx_mail_pop3_module
65.ngx_mail_proxy_module
66.ngx_mail_smtp_module
67.ngx_mail_ssl_module
68.ngx_stream_access_module
69.ngx_stream_core_module
70.ngx_stream_geoip_module
71.ngx_stream_geo_module
72.ngx_stream_js_module
73.ngx_stream_limit_conn_module
74.ngx_stream_log_module
75.ngx_stream_map_module
76.ngx_stream_proxy_module
77.ngx_stream_realip_module
78.ngx_stream_return_module
79.ngx_stream_split_clients_module
80.ngx_stream_ssl_module
81.ngx_stream_ssl_preread_module
82.ngx_stream_upstream_hc_module
83.ngx_stream_upstream_module