|
Home >Online Product Documentation >Table of Contents >Frequently Asked Questions About XSLT Frequently Asked Questions About XSLTHow can I use quoted strings inside an attribute value?
If you need to include a quoted string inside an attribute value (in a How do I choose when to use xsl:for-each and when to use xsl:apply-templates?
The way
With Finding a template by matching requires more time than using the contained template. However, matching allows for more flexibility. Also, matching lets you avoid repeating templates that might be used in more than one place in a stylesheet. Named templates are another option for invoking a template from more than one place in a stylesheet, when you know which template you want. It is a common mistake to use (and bear the overhead of) matching when it is not needed. But it allows you to do powerful things. Matching can take into account the following:
Most complex document-formatting stylesheets use
How can I insert JavaScript in my result document? If you want your result document to contain JavaScript commands, you must properly escape the JavaScript code. Use the following format in your XSLT template:
However, this method does not work when your JavaScript section contains a block of XSLT code. In this case, enclosing the JavaScript in a
In this situation, enclose the entity reference within an You can use this wherever an entity reference needs to be handled specifically, as opposed to being handled as part of an entire JavaScript section. My browser does not understand the tag <br/>. How can I output just <br>? Although your XSLT stylesheet must contain valid XML (meaning all tags must be either empty or have a closing element), you can instruct the XSLT processor to generate output compliant with HTML. See Deleting Templates. Alternative: To ensure that your stylesheet always generates correct HTML, specify the |