Re: Editing XML



Maarten Wiltink wrote:

To transform
<MSHelp:link keywords="***">click here</MSHelp:link>
into
<a href="html/***.htm">click here</a>,
something like

<xsl:template match="MSHelp:link">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:text>html/</xsl:text>
<xsl:value-of select="@keywords" />
<xsl:text>.htm</xsl:text>
</xsl:attribute>
<xsl:apply-templates select="*|text()" /> <!-- exclude @* -->
</xsl:element>
</xsl:template>

Not tested.

Thanks, now I have some hints on where to start looking into XSLT :-)

> <xsl:apply-templates select="*|text()" /> <!-- exclude @* -->

Does here "@" refer to (all?) attributes, "*" to all childnodes, and text() to the text? The members of the elements (or nodes?) still are somewhat unclear to me :-(

Also I didn't understand the difference between XMLDoc.DocumentElement, ..Node and .ChildNodes. Is .Node the very root node of the document, whose children are the .ChildNodes, and .DocumentElement is one of these children? There also seems to exist a flat list of all elements or nodes in a document?

DoDi
.