Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Detecting upper case [Thread Next] Re: Detecting upper caseTo: NULL Date: 7/11/2006 9:51:00 PM Here's what I believe is a "clean" pure XSLT solution (the XSLT 1.0 solution is quite similar): When the following transformation is applied against any xml document (not used): <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:f="http://fxsl.sf.net/" xmlns:testmap="testmap" exclude-result-prefixes="f testmap" > <xsl:import href="../f/func-str-dvc-map.xsl"/> <xsl:variable name="vCaps" select= "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <!-- to be applied on any xml source --> <xsl:variable name="vTestMap" as="element()"> <testmap:testmap/> </xsl:variable> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/"> <xsl:value-of select="f:str-map($vTestMap, 'DocumentLogicalType')"/> </xsl:template> <xsl:template name="double" match="testmap:*" mode="f:FXSL"> <xsl:param name="arg1"/> <xsl:value-of select= "concat(if(contains($vCaps, $arg1)) then ' ' else '', $arg1)" /> </xsl:template> </xsl:stylesheet> the wanted result is produced: " Document Logical Type" Cheers, Dimitre Novatchev "Anthony Jones" <Ant@y...> wrote in message news:uemLNnTpGHA.4424@T...... > > "FinallyInSeattle" <lori.pearsall7@g...> wrote in message > news:1152570079.433737.295700@p...... >> I have the situation where I have a document element that looks like >> the following: >> >> <field key="DocumentLogicalType">Submission</field> >> >> I'd like to render "DocumentLogicalType" as "Document Logical Type" - >> basically inserting a space whenever an upper case character is >> encountered. How do I detect upper case (as opposed to a translation)? >> >> Thanks in advance! >> > > Mukul's code well demonstrates the problems of implementing a 'procedure' > in > xsl. > > If all you have is a hammer everything looks like a nail. > > If you absolutely have to implement this in XSL then the solution works > but > if you have other choices then perhaps those choices would be better. > > A few of Ideas:- > > If your target processor is MSXML then embedding some script in the XSL > that > will handle this much more cleanly. MSXML and possibly others support > adding objects to the processor to supply extended functions. > > Pre-process the XML adding an attribute contain your prefered display > string > or replace the value with you prefered string. > > Anthony. > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
