Nginx中文文档
DocsHome
  • 贡献导引
  • 介绍
    • 安装 nginx
    • 从源码构建 nginx
    • 初学者指南
    • 管理指南
    • 控制 nginx
    • 连接处理方式
    • 设置哈希
    • 调试日志
    • 记录日志到 syslog
    • 配置文件度量单位
    • 命令行参数
    • Windows 下的 nginx
    • QUIC 和 HTTP/3 支持
    • nginx 如何处理请求
    • 服务器名称
    • 使用 nginx 作为 HTTP 负载均衡器
    • 配置 HTTPS 服务器
    • nginx 如何处理 TCP/UDP 会话
    • 关于 nginScript
  • 其他
    • Linux 软件包
  • How-To
    • 在 Win32 平台上使用 Visual C 构建 nginx
    • 设置 Amazon EC2 的 Nginx Plus 环境
    • 使用 DTrace pid 提供程序调试 nginx
    • 转换重写规则
    • WebSocket 代理
  • 开发
    • 贡献指南
    • 开发指南
  • 模块参考
  • 核心功能
    • HTTP
      • ngx_http_core_module
      • ngx_http_access_module
      • ngx_http_addition_module
      • ngx_http_api_module
      • ngx_http_auth_basic_module
      • ngx_http_auth_jwt_module
      • ngx_http_auth_request_module
      • ngx_http_autoindex_module
      • ngx_http_browser_module
      • ngx_http_charset_module
      • ngx_http_dav_module
      • ngx_http_empty_gif_module
      • ngx_http_f4f_module
      • ngx_http_fastcgi_module
      • ngx_http_flv_module
      • ngx_http_geo_module
      • ngx_http_geoip_module
      • ngx_http_grpc_module
      • ngx_http_gunzip_module
      • ngx_http_gzip_module
      • ngx_http_gzip_static_module
      • ngx_http_headers_module
      • ngx_http_hls_module
      • ngx_http_image_filter_module
      • ngx_http_index_module
      • ngx_http_js_module
      • ngx_http_keyval_module
      • ngx_http_limit_conn_module
      • ngx_http_limit_req_module
      • ngx_http_log_module
      • ngx_http_map_module
      • ngx_http_memcached_module
      • ngx_http_mirror_module
      • ngx_http_mp4_module
      • ngx_http_perl_module
      • ngx_http_proxy_module
      • ngx_http_random_index_module
      • ngx_http_realip_module
      • ngx_http_referer_module
      • ngx_http_rewrite_module
      • ngx_http_scgi_module
      • ngx_http_secure_link_module
      • ngx_http_session_log_module
      • ngx_http_slice_module
      • ngx_http_spdy_module(过时)
      • ngx_http_split_clients_module
      • ngx_http_ssi_module
      • ngx_http_ssl_module
      • ngx_http_status_module(过时)
      • ngx_http_stub_status_module
      • ngx_http_sub_module
      • ngx_http_upstream_module
      • ngx_http_upstream_conf_module
      • ngx_http_upstream_hc_module
      • ngx_http_userid_module
      • ngx_http_uwsgi_module
      • ngx_http_v2_module
      • ngx_http_xslt_module
    • Mail
      • ngx_mail_core_module
      • ngx_mail_auth_http_module
      • ngx_mail_proxy_module
      • ngx_mail_ssl_module
      • ngx_mail_imap_module
      • ngx_mail_pop3_module
      • ngx_mail_smtp_module
    • Stream
      • ngx_stream_core_module
      • ngx_stream_access_module
      • ngx_stream_geo_module
      • ngx_stream_geoip_module
      • ngx_stream_js_module
      • ngx_stream_keyval_module
      • ngx_stream_limit_conn_module
      • ngx_stream_log_module
      • ngx_stream_map_module
      • ngx_stream_proxy_module
      • ngx_stream_realip_module
      • ngx_stream_return_module
      • ngx_stream_split_clients_module
      • ngx_stream_ssl_module
      • ngx_stream_ssl_preread_module
      • ngx_stream_upstream_module
      • ngx_stream_upstream_hc_module
      • ngx_stream_zone_sync_module
    • 其他
      • ngx_google_perftools_module
由 GitBook 提供支持
在本页
  • 示例配置
  • 指令
  • xml_entities
  • xslt_last_modified
  • xslt_param
  • xslt_string_param
  • xslt_stylesheet
  • xslt_types
  • 原文档
  1. 核心功能
  2. HTTP

ngx_http_xslt_module

上一页ngx_http_v2_module下一页Mail

最后更新于5年前

ngx_http_xslt_module(0.7.8+)是一个过滤器,可使用一个或多个 XSLT 样式表来转换 XML 响应。

默认不构建此模块,可在构建时使用 --with-http_xslt_module 配置参数启用。

该模块雨来 和 库。

示例配置

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

指令

xml_entities

-

说明

语法

xml_entities path;

默认

——

上下文

http、server、location

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

<!ENTITY nbsp "&#xa0;">

xslt_last_modified

-

说明

语法

xslt_last_modified on | off;

默认

xslt_last_modified off;

上下文

http、server、location

提示

该指令在 1.5.1 版本中出现

允许在 XSLT 转换期间保留原始响应中的 Last-Modified 头字段,以方便响应缓存。

默认情况下,在转换期间修改响应的内容时,将删除头字段,并且该头字段可能包含动态生成的元素或片段,这些元素或片段独立于原始响应更改。

xslt_param

-

说明

语法

xslt_param parameter value;

默认

——

上下文

http、server、location

提示

该指令在 1.1.18 版本中出现

xslt_string_param

-

说明

语法

xslt_string_param parameter value;

默认

——

上下文

http、server、location

提示

该指令在 1.1.18 版本中出现

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

xslt_stylesheet

-

说明

语法

xslt_stylesheet stylesheet [parameter=value ...];

默认

——

上下文

http、server、location

定义 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

-

说明

语法

xslt_types mime-type ...;

默认

xslt_types text/xml;

上下文

http、server、location

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

原文档

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

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

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

http://nginx.org/en/docs/http/ngx_http_xslt_module.html
libxml2
libxslt
示例配置
指令
xml_entities
xslt_last_modified
xslt_param
xslt_string_param
xslt_stylesheet
xslt_types
xslt_string_param
xslt_string_param
xslt_param