It’s been long time that I haven’t update my blog, I know but I was so busy in my schedule that didn’t find out time to write some good article. I had done some fantastic work during this time. And during my work find out something interesting in Dreamweaver CS5, which I want to share with you all.
In XSLT, some characters are not allowed in certain contexts. For example, you cannot use the less than sign (<) and the ampersand (&) in the text between tags or in an attribute value. The XSLT transformation engine will give you an error if those characters are used incorrectly. To solve the problem, you can specify character entities to replace the special characters.
A character entity is a string of characters that represents other characters. Character entities are either named or numbered. A named entity begins with an ampersand (&) followed by the name or characters, and ends with a semicolon (;). For example, < represents the left angle bracket character (<). Numbered entities also start and end the same way, except that a hash sign (#) and a number specify the character.
XSLT has the following five predefined entities:
Figure 1.1: Predefined entities
So now biggest question is that suppose if we try to write some special character, than from where we get the ‘Entity Code’ for that special character. It’s easy, look up the missing character in the character entity reference page on the W3C website i.e. www.w3.org/TR/REC-html40/sgml/entities.html
Let’s select ‘micro’ entity in the webpage. Write down its Entity and CDATA details, which are as follows: Entity: micro CDATA: µ
Figure 1.2: Entity and CDATA for ‘micro’
Now open XML file present in Dreamweaver application folder (where you install Dreamweaver, in Program files)….Configuration/DocumentTypes/MMDocumentTypesDeclarations.xml
Open this XML file in text editor or XML editor of your choice. Locate the text ‘mm_xslt_1’ and,
Figure 1.3: mm_xslt_1 declaration
after that place Entity and CDATA in appropriate location. Save the XML file.
Figure 1.4: Entity and CDATA
Now, open Dreamweaver CS5, and in Code view write µ …………….. Its amazing to see micro sign on Design view of Dreamweaver CS5.
Figure 1.5: ‘micro’ sign in Code and Design view
You can experiment with many symbols available in W3C website.
Reference: Dreamweaver help, other internet links