XSLT/XPath challenge… help needed
This is an open discussion with 3 replies, filed under XSLT.
Search
Assumed that you are using the Ninja technique to transform HTML, e.g.:
<xsl:template match="*" mode="html"> <xsl:element name="{name()}"> <xsl:apply-templates select="* | @* | text()" mode="html"/> </xsl:element> </xsl:template>
you could simply create an overriding template like so:
<xsl:template match="body/*[1]" mode="html"> <xsl:element name="{name()}"> <xsl:value-of select="ancestor::entry/title"/> <xsl:text> - </xsl:text> <xsl:apply-templates select="* | @* | text()" mode="html"/> </xsl:element> </xsl:template>
Exactly. Thank you! My mind has been mush lately. Thank you so very @michael-e. Very helpful!
You're welcome. Believe me, I know these days…
Create an account or sign in to comment.
Hey everyone. Here is what I am trying to end up with…
"The Page Title" is in a regular text field called Title.
The "Lorem ipsum…" part is a text area field called Body.
What I'd like to do is put the
<a href="#">The Page Title</a> -
part and append it to the first part of the body (inside the paragraph tag)Unfortunately, I've been working way overtime over the last few weeks without much sleep. I need some help on this one.
Thanks.