Connecting Tech Pros Worldwide Help | Site Map

XSLT question -- template for an unpredictable element

Newbie
 
Join Date: Jun 2008
Posts: 1
#1: Jun 26 '08
Hi,

Using a data structure of:

<ead>
<archdesc>
...
</archdesc>
</ead>

In my data structure, a <extref> element can occur virtually anywhere inside an element named <archdesc> and might look something like.

<extref href="">...</extref>

A general xslt template for processing <archdesc> works just fine, by having a simple template:

<xsl:template match="/ead">
<html>
<body>
<xsl:apply-templates select="archdesc"/>
</body>
</html>
</xsl:template>

and to cover the occurrence of <extref> virtually anywhere inside <archdesc>, my stylesheet has another template:

<xsl:template match="//extref">
<a href="{@href}">
<xsl:value-of select="."/>
</a>
</xsl:template>

However, when I run the XML through the stylesheet, all of the instructions in the template for archdesc execute just fine, but the instructions for //extref are ignored.

Any suggestions?

Thanks,

Chuck Thomas
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#2: Jun 26 '08

re: XSLT question -- template for an unpredictable element


It sounds like the extref template is never reached. One of your other templates is probably not calling apply-templates, and never fully porcessing extref. Would have to see the XSL.
Reply