need to display char in xslt -


hi using xslt 1.0. have char code foa7 has displayed corresponding character. input

<w:sym w:font="wingdings" w:char="f0a7"/>

my xslt template

<xsl:template match="w:sym">     <xsl:variable name="char" select="@w:char"/>     <span font-family="{@w:fonts}">             <xsl:value-of select="concat('&#x',$char,';')"/>     </span> </xsl:template> 

it showing error error: 'a decimal representation must follow "&#" in character reference.'

please me in fixing this..thanks in advance...

this isn't possible in (reasonable) xslt. can work around it.

  • your solution concat invalid: xslt not fancy string-concatenator, transforms conceptual tree. encoded character such &#xf0a7; single character - if somehow include letters & # x f 0 a 7 ; xslt processor required include these letters in xml data - not string! means escape them.
  • there's no feature in xslt 1.0 permits converting number character codepoint.
  • in xslt 2.0, michael kay points out, can use codepoints-to-string() achieve this.

there 2 solutions. firstly, use disable-output-escaping. rather nasty , not portable. avoid @ costs if can - work in transformer, , it's general, simple solution, may not able avoid this.

the second solution hardcode matches each individual character. that's mess generally, quite possible if you're dealing limited set of possibilities - depends on specific problem.

finally, i'd recommend not solving problem in xslt - typically can in pre/post processing in programming environment more appropriately. likely, you've in-memory representation of xml document able use xslt in first place, in case won't take cpu time.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -