[xsl] Parameter substitution

Subject: [xsl] Parameter substitution
From: Curtis Burisch <burisch@xxxxxxxxxxx>
Date: Wed, 19 Dec 2001 17:31:34 +0000
Hi,

I was going to start this message with something other than the 
ubiquitous "Hi I'm a newbie and I can't figure out how to do xyz can 
somebody PLEEZ help me" but alas I have failed in that, so let's cut to 
the chase:

Below is given a fragment from an XML document. Of note are the 
contents of the <ErrorText> nodes; the first one has a value of "%1 %2 
is not a valid date format.".

My task, (you guessed it) is to replace each %1, %2 etc.. with a string 
built from the correspondong ErrorParameter (formatted nicely of course)
. Being relatively new to XSLT, I can't think of a way to accomplish 
this in a generic manner. Has anyone got any ideas? I can't think of an 
approach that will actually work!

Thanks,
Curtis.

<InvalidBody>
<SynchError>
<ErrorId>1</ErrorId>
<ErrorKey>S12006</ErrorKey>
<ErrorText>%1 %2 is not a valid date format.</ErrorText>
<ErrorParameter>
<ErrorParameterType>X</ErrorParameterType>
<ErrorParameterValue>Some/XPATH/To/The/Offending/Value/Goes/In/Here</
ErrorParameterValue>
</ErrorParameter>
<ErrorParameter>
<ErrorParameterType>value</ErrorParameterType>
<ErrorParameterValue>2001212109</ErrorParameterValue>
</ErrorParameter>
</SynchError>
<SynchError>
<ErrorId>1</ErrorId>
<ErrorKey>S12006</ErrorKey>
<ErrorText>Dummy error message</ErrorText>
<ErrorURL>http://www.cnn.com</ErrorURL>
</SynchError>
<OriginalMessage>&lt;Original XML message as sent in.&gt;</
OriginalMessage>
</InvalidBody>

-- 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread