|
Subject: Re: [xsl] [XPath] matching elements which satisfy a specific content model From: Tobias Reif <tobiasreif@xxxxxxxxxxxxx> Date: Mon, 13 Jan 2003 12:29:43 +0100 |
> I find it's rare to ever need this kind of test though. > > If your input may include > > <variablelist> > <title></title> > </variablelist> > > > and > > > <variablelist> > <title></title> > <varlistentry/> > </variablelist> > > > how do you want them to be processed?
> If the first is an error you can arrange to dtd validate before > transforming in which case such fragments will never get as far as > XSLt > so you don't need to check for them in the pattern.
> If validation is not an option it's often simpler to match on the > simpler * case but then have > <xsl:if test="not(varlistentry)">...
> Do you really have a case where you want to accept both these things > but > teh reulting output is so different that you don't want to share a > template for the two cases?
[very hackish draft of pseudo-code]
<t:template match="variablelist[]">
<t:if test="title">
<t:element name="h{count(ancestor::*)}">
<t:value-of select="title"/>
</t:element>
</t:test>
<dl>
<t:apply-templates/>
</dl>
</t:template>
<!-- quirky -->
<t:template match="variablelist[]/title"/>Vim users donate. http://iccf-holland.org/donate.html
Web developers check. http://www.pinkjuice.com/check/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] [XPath] matching elements, David Carlisle | Thread | Re: [xsl] [XPath] matching elements, Tobias Reif |
| Re: [xsl] [XPath] matching elements, Tobias Reif | Date | Re: [xsl] [XPath] matching elements, Tobias Reif |
| Month |