I'm trying to format XML files so that I can display them as examples in a
wiki. I'd like the element names in the examples to link to other wiki pages,
so I'm trying to figure out the best way to take source like this:
<ns:elementName1>
<ns:elementName2>value</ns:elementName2>
</ns:elementName1>
And get output like this:
<[ns:elementName1|page 1]>
<[ns:elementName2|page 2]>value</ns:elementName2>
</ns:elementName1>
Of course, "[ns:elementName|page]" isn't a valid qname so just trying to rename
the elements in an XML to XML transform doesn't work.
I've messed around a bit trying to output HTML that looks the way I want it to
look, including indentation, eg:
<xsl:for-each
select="rss/channel/title|rss/channel/link|rss/channel/description">
<xsl:variable name="value" select="text()" />
<xsl:variable name="name" select="name()" />
<xsl:variable name="newName" select="concat($open, $name, $linkEnd)" />
<<xsl:value-of
select="$newName"/>><xsl:value-of select="$value"/></<xsl:value-of
select="$name"/>><br />
</xsl:for-each>
That works fine for simple inline elements, but it I'm not sure how to deal
with nodes with children.
Before I give myself a headache trying to figure it out, I was wondering if
anyone could suggest a better approach I should look into.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--