Rupa (archive)
Usenet Archive
- Joined
- Jan 7, 2004
- Messages
- 1
- Reaction score
- 0
Hi,
I'm trying to write an xslt to convert an email in xml format to a new xml format.
<descr>
<xsl:choose> <xsl:value-of select="body"> </xsl:value-of select> <xsl:when test=" <xsl:value-of select="body/size_in_chars"> > 1042"></xsl:when> <xsl
therwise> SOMETHING HERE THAT I HAVEN'T SORTED OUT YET </xsl
therwise> </xsl:choose> </descr>
My first problem is the test condition. I need to check whether the size of the body of the email is less than 1024. In the original xml document, it looks like this:
<body size_in_chars="someNumber"> body of email is here </body>
Is there a way for me to access the size_in_chars element and use it in my test?
My second problem is that if the body is greater than 1024, I need to truncate the body after that and select only the first 1024 characters for <descr>. Something like this:
<descr> <xsl:value-of select=truncate("body", 1024)> </xsl:value-of> </descr>
(I'm just using truncate as a way to show what I need to do - don't know if there actually is a function to do that and what it would be called if it exists.)
Thanks!
Rupa
I'm trying to write an xslt to convert an email in xml format to a new xml format.
<descr>
<xsl:choose> <xsl:value-of select="body"> </xsl:value-of select> <xsl:when test=" <xsl:value-of select="body/size_in_chars"> > 1042"></xsl:when> <xsl
My first problem is the test condition. I need to check whether the size of the body of the email is less than 1024. In the original xml document, it looks like this:
<body size_in_chars="someNumber"> body of email is here </body>
Is there a way for me to access the size_in_chars element and use it in my test?
My second problem is that if the body is greater than 1024, I need to truncate the body after that and select only the first 1024 characters for <descr>. Something like this:
<descr> <xsl:value-of select=truncate("body", 1024)> </xsl:value-of> </descr>
(I'm just using truncate as a way to show what I need to do - don't know if there actually is a function to do that and what it would be called if it exists.)
Thanks!
Rupa