Jump to content

phonetic symbol font (how to output and view in html)


hainhim

Recommended Posts

Hi, everybody.I use "Arial Unicode MS" font in my XML, but i can not view exactly in html asɑ ɒ ɔ ə ɜ æ e ɪ ʊ ʌð θ ʒ ʤ ɮ ʃ ʧ ŋ ɡsome of them is square only.Why?and how to change font in xslt?i can change font color, font size, but cannot change font face.i try to attemp (an example in w3schools.com):<xsl:attribute-set name="font"> <xsl:attribute name="fname">Arial</xsl:attribute> <xsl:attribute name="size">14px</xsl:attribute> <xsl:attribute name="color">red</xsl:attribute></xsl:attribute-set>butThe XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. --------------------------------------------------------------------------------Keyword xsl:attribute-set may not be used here. Anybody give me a detail code about xsl:attribute-set!Help me, please!Thanks for all reply!

Link to comment
Share on other sites

xsl:attribute-set needs to be at the top level i.e. a direct child of xsl:stylesheet. When you want to apply it on an element, you need to use xsl:element's use-attribute-sets attribute to place the attribute set in there. Example:

<xsl:stylesheet ...><xsl:attribute-set name="font"><xsl:attribute name="fname">Arial</xsl:attribute><xsl:attribute name="size">14px</xsl:attribute><xsl:attribute name="color">red</xsl:attribute></xsl:attribute-set><xsl:template match="/"><xsl:element name="div" use-attribute-sets="font">div's content</xsl:element></xsl:template></xsl:stylesheet>

Link to comment
Share on other sites

Hi, boen_robot!I respect your knowledge.Thanks about all your guides in this forum.Can you help me again.I try with your idea sometimes but it's not run (sorry, i'm stupid)this is my xml<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE vocabulary []><?xml-stylesheet type="text/xsl" href="test_VOCABULARY.xsl"?><vocabulary> <word> <headword>a</headword> <pronunciation>/eɪ/ /ə/</pronunciation> </word></vocabulary>this is my xsl<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:attribute-set name="font"><xsl:attribute name="fname">century</xsl:attribute><xsl:attribute name="size">14px</xsl:attribute><xsl:attribute name="color">red</xsl:attribute></xsl:attribute-set> <xsl:template match="/"> <xsl:element name="div" use-attribute-sets="font"> <xsl:for-each select="vocabulary/word"> <xsl:value-of select="headword"/> <xsl:value-of select="pronunciation"/> </xsl:for-each> </xsl:element> </xsl:template></xsl:stylesheet>Please, correct it, i don't know how to debug it.(Sorry about my English)Thanks again.

Link to comment
Share on other sites

It all works fine for me.You should save your files as UTF-8 (as I did), and ensure that your server serves them with UTF-8 too. If they are saved as ANSI, it won't work.Opening notepad, copy your XML from this topic (the one you currently have is already damaged), click "Save as", and in the type, choose "All Files", and then (this is the key part), on the menu below that, select "UTF-8", and then click "Save".Do the same for the XSLT file.You could also try to represent each character as an entity, but that would increase a lot the size of your XML, so use it only as a last resort. I mean use something like:

<pronunciation> & #160; </pronunciation>

( & #160; is the entity for non-breakable space)but replace the entity number with the actual number of the character, and remove the space between "&" and "#" (I've added it because this board interprets entities).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...