Subject: [xsl] using normalize-space with mixed element content (more info) From: "Lynn Murdock" <lmurdock@xxxxxxxx> Date: Tue, 8 Jun 2010 16:44:50 -0700 |
i forgot to include some info: i'm using xslt 2.0, with saxon (8.7), integrated into an IDE (intellij). i also forgot to mention that normalize-space is not removing the whitespace between the italic tags, it's just stripping the italic formatting. thanks- lynn ------ hi- i want to remove trailing whitespace from the contents of an element (<article-title>), but because that element sometimes contains character-level formatting elements (<italic>) as well as text, normalize-space is creating problems. if i use normalize-space(), i lose the italics in the output. (i'm transforming to html.) here's an example of where i want to remove whitespace (i want to remove the space before </article-title>): <title-group> <article-title>Effect of a Brief Video Intervention on Incident Infection among Patients Attending Sexually Transmitted Disease Clinics </article-title> </title-group> and here's the xsl code i've used: <xsl:template match="title-group/article-title" mode="none"> <xsl:value-of select="normalize-space(.)"/> </xsl:template> this code works most of the time, but in a situation like this: <article-title>A Global Survey of Gene Regulation during Cold Acclimation in <italic>Arabidopsis</italic> <italic>thaliana</italic></article-title> it ends up removing the italic formatting. does anyone know of a way to strip the whitespace that i don't want (in the first example) while keeping the character formatting that i do want (in the second example)? any pointers would be greatly appreciated. thanks- lynn ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ---------------------------------------------------------------- This email is confidential to the intended recipient. If you have received it in error, please notify the sender and delete it from your system. Any unauthorized use, disclosure or copying is not permitted. The views or opinions presented are solely those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Please note that neither Public Library of Science nor any of its agents accept any responsibility for any viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any).
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] using normalize-space wit, David Carlisle | Thread | Re: [xsl] using normalize-space wit, David Carlisle |
Re: [xsl] using normalize-space wit, David Carlisle | Date | Re: [xsl] using normalize-space wit, David Carlisle |
Month |