HTTP/2 301
server: Apache
content-security-policy: default-src https://www.oreilly.com/OAeswiOMT/bR/BvJ6V1g/ui3kc2JkkJQpzr9V/UWM9Uw/JH/AHX2JUb0o * 'unsafe-inline' 'unsafe-eval' data: blob: android-webview-video-poster: moz-extension: ms-browser-extension: chrome-extension: ios-log:;
location: https://www.oreilly.com/catalog/9780596003722/
content-type: text/html; charset=iso-8859-1
x-akamai-transformed: 0 - 0 -
cache-control: max-age=14400
expires: Sun, 12 Oct 2025 04:28:23 GMT
date: Sun, 12 Oct 2025 00:28:23 GMT
set-cookie: akaalb_OReillyALB=~op=www_oreilly_com_GCP_LB_for_Siteshield:www_gcp_siteshield|~rv=69~m=www_gcp_siteshield:0|~os=ea59de9527866dfb0dcb25ebf250c4a3~id=cf581fe2e193b08694f0057ca27c76e8; path=/; HttpOnly; Secure; SameSite=None
referrer-policy: strict-origin
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
set-cookie: _abck=AFA6E0215F2AFAC89B7A2CC1CC990438~-1~YAAQbq1NaDCuxsWZAQAAgonR1Q7iKgyxrGbO2GQzK93xo8VbOBt5brVlG9MIxhm3oU8UGMHiKbHD0PS/RjCquOBeqv8XgMXaHUj4GKGi+ZvKVcgM0L9aXmkcomsk4wla/1ZJ8RnOmGTv2ipxQM+Tixtp05TlFzrK5ZMrmr1CO1xGOZaSl2mWo4k3vqlRiSYLFRLV0eLwz0rX5THPWGn0FH/VBEZE3oUcxLYz47OLvgpYCW7S1wzCM2kGItstzXQ5yje+PpjRbRWB9fOkcLynaXJSOoIDD7/gvDq/5fZcn6c8Cr+rBnSeNgrm/jJHgzrBLh8wkswLeM8q98wqeLaZ/j9j9XOJKPVCbkxgrPv5jFOoFlL22CFX0EnMVrQwu/TpgYVvDs9F0NEmSGFPmp2eMkl2ioR9vYOWJyeNG9gf+QQSs3ACQrOwsIkbC0D9hSBA+sus9HInOhEY~-1~-1~-1~-1~-1; Domain=.oreilly.com; Path=/; Expires=Mon, 12 Oct 2026 00:28:23 GMT; Max-Age=31536000; Secure
set-cookie: bm_sz=D975F0BF086440EF86C2A3C65C87E2FE~YAAQbq1NaDGuxsWZAQAAgonR1R0J+HnfuEdIB/EQ9AkyKj6KAlqU+IBsuggepDWh0SGedKsCIgOSP1fv9acH/y5C0dq230HXNTH1ML2y/SVATMsitR+ZC6xHs0/dbzOgYR0Xi2aDDA/89preCsQ67n5+LnDjutwqkqqAj4KEe18udAHxIgCULlxpl36BffoovOqRsU3f9/zQo84wlDWk8IUrHBLpDJbFs8vimpsTsrf6TFiNeLbMMz8dzpYJOFmHtQHoPwKiERgwBHNB+7uzLqfZ3W/oqykjiKiI5mOJkoLx+1RstZ0SJdW/vKKpX1NJkZqNNR/3Elbvb/yG9n7dGFdVpTcGijlczEP7sRIchN8jHGcei/tndvQ=~3551287~3485753; Domain=.oreilly.com; Path=/; Expires=Sun, 12 Oct 2025 04:28:22 GMT; Max-Age=14399
HTTP/1.1 301 Moved Permanently
Server: AkamaiGHost
Content-Length: 0
Location: https://www.oreilly.com/catalog/9780596003722/
Date: Sun, 12 Oct 2025 00:28:23 GMT
Connection: keep-alive
Set-Cookie: akaalb_OReillyALB=~op=www_oreilly_com_GCP_LB_for_Siteshield:www_gcp_siteshield|~rv=6~m=www_gcp_siteshield:0|~os=ea59de9527866dfb0dcb25ebf250c4a3~id=24732c7b1362732a37f114f6155b0809; path=/; HttpOnly
referrer-policy: strict-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Set-Cookie: _abck=E81F2E7F17B129C3DEB471548E377DB4~-1~YAAQbq1NaDKuxsWZAQAAlInR1Q6JCjwjp/0RbsJa2Mwls0n5q4yNMVmSSSS7hzvmX2kGmAl0stQm5V2mC16MiJMexgVMrLW436LY8AeQpeIEYr4W1byKlT44CKktIoP/KcW21TrAeJuxdqcnp+0l2lzl1Wj3jk5fDjc97RL92rO6L6IE6KE8CxNAMbMfMS7yOLdjpwvLcGRQg3od6SSJHzPvjqLx1T9NN89wW8eaLcMexwmc9oBkwMKbbHbEb0eb7s0WHj2wdzgY8z3PtbcUFD4Gq0p9wtXl6SvTyD1ep2UGUOgjylT/MXiBYgh5cWsvERWHlOtpAwdvojjlznWZ8UPsM2xERgafkoeK80zwwA==~-1~-1~-1~-1~-1; Domain=.oreilly.com; Path=/; Expires=Mon, 12 Oct 2026 00:28:23 GMT; Max-Age=31536000
HTTP/2 301
server: Apache
content-security-policy: default-src https://www.oreilly.com/OAeswiOMT/bR/BvJ6V1g/ui3kc2JkkJQpzr9V/UWM9Uw/JH/AHX2JUb0o * 'unsafe-inline' 'unsafe-eval' data: blob: android-webview-video-poster: moz-extension: ms-browser-extension: chrome-extension: ios-log:;
location: https://shop.oreilly.com/product/9780596003722.do
vary: Accept-Encoding
content-type: text/html; charset=utf-8
x-akamai-transformed: 0 - 0 -
content-encoding: gzip
expires: Sun, 12 Oct 2025 00:28:23 GMT
cache-control: max-age=0, no-cache, no-store
pragma: no-cache
date: Sun, 12 Oct 2025 00:28:23 GMT
referrer-policy: strict-origin
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
HTTP/1.1 301 Moved Permanently
Server: AkamaiGHost
Content-Length: 0
Location: https://shop.oreilly.com/product/9780596003722.do
Date: Sun, 12 Oct 2025 00:28:24 GMT
Connection: keep-alive
Set-Cookie: akaalb_https_misc_subs=~op=gcp_secure_oreilly_subs_lb:gcp_secure_oreilly_subs_ss|~rv=57~m=gcp_secure_oreilly_subs_ss:0|~os=954a53b2163c938fc6be3874c0b66cd7~id=76732075ae47d6f80aa0b22a2e966027; path=/; HttpOnly
Referrer-Policy: strict-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Set-Cookie: _abck=D7F909263605D8C7CB8B9475931D6DCF~-1~YAAQhtcLFw9RFZiZAQAAmo3R1Q7P3VC4qe/4Ei/1qJo8YT1Eb9ZD7edibL0Eeo+3OzF6LbkJ1bpzplOwH9ZbxnggvtBkoN1R0YhMtBexCEUtjc39sNY1lebWY88IprucjRxUy1XJbf608G2hIbN7yj9Nl+9hgkK2CyBc2oykLJCLkJTrPp10eDVFKcmCSSMY+8TjmK+mZITJswd0fk/1SbX6nvp9UDpRyrJx15xv4jTmDNW2rMA0dU6d36KJrJqkKvAgTx0QNkuuPUbt/1hlCGhvo3XtfmIlF0Krdq96kMaiB0iQeYfw+2cGo9mZ/qd50PLqAXnykZ/HhGuSaAU5y0TiBGgfK+3hnGlgmP2GKg==~-1~-1~-1~-1~-1; Domain=.oreilly.com; Path=/; Expires=Mon, 12 Oct 2026 00:28:24 GMT; Max-Age=31536000
HTTP/2 301
server: Apache
location: https://www.oreilly.com/library/view/~/0596003722/
content-type: text/html; charset=iso-8859-1
x-akamai-transformed: 0 - 0 -
cache-control: max-age=2592000
expires: Tue, 11 Nov 2025 00:28:25 GMT
date: Sun, 12 Oct 2025 00:28:25 GMT
referrer-policy: strict-origin
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
HTTP/2 301
server: istio-envoy
content-type: text/plain; charset=utf-8
content-length: 73
location: /library/view/xslt-cookbook/0596003722/
vary: Accept
x-envoy-upstream-service-time: 379
cache-control: must-revalidate, max-age=3600, s-maxage=31536000
date: Sun, 12 Oct 2025 00:28:26 GMT
referrer-policy: strict-origin
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
HTTP/2 200
server: istio-envoy
content-type: text/html; charset=utf-8
vary: Accept-Encoding
etag: W/"8fa10-2xehWd+oTRc71WZJhpTXm1Tz8Fk"
x-envoy-upstream-service-time: 389
x-akamai-transformed: 0 - 0 -
content-encoding: gzip
cache-control: must-revalidate, max-age=3600, s-maxage=31536000
date: Sun, 12 Oct 2025 00:28:26 GMT
referrer-policy: strict-origin
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
XSLT Cookbook [Book]
Skip to Main Content December 2002
Intermediate to advanced content level Intermediate to advanced
Contents Testing if a String Ends with Another String Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Formatting Numbers Problem Solution Use xsl:decimal-format in conjunction with format-number( ) Use xsl:number Discussion Formatting numbers into columns using a fixed number of decimal places Formatting money like U.S. accountants Formatting numbers for many European countries Converting numbers to Roman numerals Creating column numbers like a spreadsheet Formatting numbers using Arabic characters
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Absolute value: math:abs(x) Square root: math:sqrt(x) Logarithms: math:log10(number), math:log(number), and math:logN(x,base) Power: math:power(base,power) Factorial Discussion
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Optimizing Node Selections Problem Solution Avoid unnecessary reliance on default processing rules Avoid using the descendant, descendant-or-self, preceding, or following axes when they aren’t necessary Prefer “selecting” and “matching” over “filtering” Cache frequently used node sets in variables Use xsl:key if nodes are frequently selected by static criteria Discussion Avoid unnecessarily reliance on default processing rules Prefer “selecting” and “matching” over “filtering” Cache frequently used node sets in variables Use xsl:key if nodes will be selected by static criteria frequently
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Dealing with Whitespace Problem Solution Too much whitespace Too little whitespace Discussion See Also
Problem Solution Create a CSV file from flat attribute-encoded elements Create a CSV file from flat element-encoded data Handle more complex mappings Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Number siblings sequentially Start from a number other than one Number elements globally Number elements globally within a subcontext Number hierarchically Discussion
Problem Solution Discussion See Also
Converting Attributes to Elements Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Incorporate one document as a subpart of a parent document Weave two documents together Join elements from two documents to make new elements Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Add structure based on existing data Add structure to correct a poorly designed document Discussion Add structure based on existing data Add structure to correct a poorly designed document
Problem Solution Discussion
Performing Set Operations on Node Sets Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Using XSLT as a Styling Language Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Transforming an Existing Boilerplate SVG Problem Solution Discussion
Problem Solution Axis generation Bar generation XY plots Pie-slice generation Open-Hi-Lo-Close plots Discussion
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Generating Constant Definitions Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion See Also
Converting Visio VDX Documents to SVG Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Sorting algorithms Programming languages Root topic Page elements and layout Discussion See Also
Problem Solution Discussion See Also
Saxon Extension Functions
Problem Solution You want to output to more than one destination You want to split a complex transformation into a series of transformations in a pipeline You want to work with dates and times You need a more efficient implementation of set operations You want extended information about a node in the source tree You want to interact with a relational database You want to dynamically evaluate an XPath expression created at runtime You want to change the value of a variable You want to write first-class extension functions in XSLT Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Using xsl:message Effectively Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion See Also
Problem Solution Boundary-condition testing Error-condition testing Discussion
Introduction Extending the Content of Global Variables Using Template Tags See Also
Problem Solution Discussion See Also
Problem Solution Discussion See Also
Problem Solution Discussion
Problem Solution Discussion
Problem Solution Discussion
Show More Overview
Critical for converting XML documents, and extremely versatile, the
XSLT language nevertheless has complexities that can be daunting.
The XSLT Cookbook is a collection of hundreds of solutions
to problems that Extensible Stylesheet Language Transformations
(XSLT) developers regularly face. The recipes range from simple
string-manipulation and mathematical processing to more complex
topics like extending XSLT, testing and debugging XSLT stylesheets,
and graphics creation with SVG. Recipes can be run directly or
tweaked to fit your particular application's needs more precisely.
Each recipe walks through a problem and a solution, with
explanations of the choices made and techniques used in creating
that solution, and many recipes include alternate solutions and
explore issues like convenience and performance. Topics covered
include:
String manipulation
Mathematical processing
Date and time handling
Interactions between calendar systems
Selecting content in source documents
Efficient tree-manipulation
Conversions from XML to plain text
Tweaking XML documents with stylesheets
Using XSLT to query XML documents
Generating HTML with XSLT
Creating charts and graphs with SVG and XSLT
Generating C and XSLT code using XSLT
Processing Visio documents in XSLT
Working with XML Topic Maps (XTM)
Using XSLT to create SOAP documentation from WSDL
Extending XSLT with additional functions
Embedding XSLT in other processing
Testing and debugging XSLT stylesheets
Creating generic XSLT processors which work on many XML
vocabularies
The XSLT Cookbook provides an ideal companion both for
developers still figuring out XSLT's template-based approach who
want to learn by example, and for developers who know XSLT and want
a collection of quickly reusable recipes. XSLT frequently offers a
number of ways to perform a transformation, and the best solution
may not always be the most straightforward. The recipes in this
Cookbook demonstrate and explain XSLT's template-based logic, a
frequent stumbling block for developers new to XSLT. Among the
variety of XSLT books now available, none has the explicit
solution-oriented approach of this Cookbook.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more. Start your free trial