Subject: RE: [xsl] first question to the list: contains From: "Jared Stein" <STEINJA@xxxxxxxx> Date: Fri, 02 Nov 2007 23:22:32 -0600 |
Scott, thanks for the great explanation. Though it's disappointing (as I need to check for _any_ Japanese character to make this test effective), at least it makes sense. Luckily, it's not out of the question for me to add an additional element or attribute to the XML files--this is something I could do pretty easily with a search and replace, and would in fact add to the value of the XML. Date: Fri, 2 Nov 2007 17:39:29 -0500 To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> From: "Scott Trenda" <Scott.Trenda@xxxxxxxx> Subject: RE: [xsl] first question to the list: contains Message-ID: <DA088AB42E20F841A1CDBDD0564B8E2D0530136D@xxxxxxxxxxxxxxxxxxxx> The problem here is that XSLT operates on the expanded infoset of the parsed XML file, and is blind to the literal text that created that infoset. That is, if your XML file includes those characters (e.g. <wording>123え456</wording>), then your XSLT won't see the entity's literal text (&#12360;), it'll see that entity's value (the Japanese character). Likewise, if you use an entity in your XSLT stylesheet, then the processor will use the value of that entity, rather than the text you used to represent it. So, if you know the characters that you need to check for, you can do something like this: <xsl:if test=3D"translate(wording, 'えぉおかがきぎくぐ ;けげこごさ', '') !=3D string(wording)"> <xsl:attribute name=3D"class"> <xsl:text>fs front jpns</xsl:text> </xsl:attribute> </xsl:if> This test just wipes out the numerals in question, and checks to see if its string-value is any different than before. I guessed at the entity code numbers here - you'll have to look up their actual ones and substitute them in. If you're checking for Japanese numerals, I'm guessing you can narrow the check down to ichi (え), ni (ぉ), san (お), yon (か), go (が), roku (き), shichi (ぎ), hachi (く), kyuu (ぐ), juu (け), hyaku (げ), sen (こ), man (ご), and oku (さ). ~ Scott Jared Stein Director of Instructional Design Services Utah Valley State College, MS 149 Teaching w/ Technology Idea Exchange 2008: The Open Conference Submit your presentation proposal now! http://www.ttix.org
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] first question to the lis, Scott Trenda | Thread | RE: [xsl] first question to the lis, Michael Kay |
Re: [xsl] remove shape="rect" attri, David Carlisle | Date | [xsl] Extract footnotes, J. S. Rawat |
Month |