Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

XSLT question -- template for an unpredictable element

Question posted by: chasthomas (Newbie) on June 26th, 2008 03:50 AM
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
jkmyoung's Avatar
jkmyoung
Moderator
797 Posts
June 26th, 2008
07:48 PM
#2

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
Reply
Not the answer you were looking for? Post your question . . .
189,846 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top XML Forum Contributors