[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
russurquhart1@xxxxxxxxxxx wrote:
You code does make sense but you have not shown a complete sample where you don't get a result.
For instance when I take your stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:key name="target_ref_key" match="*[@Target]" use="@Target" />
<xsl:template match="CrossReference">
<xsl:variable name="unhash_name" select="substring-after(@href, '#')"/>
<xsl:variable name="matched" select="key('target_ref_key', $unhash_name)"/>
<xsl:if test="not($matched)">
No target for:
<xsl:value-of select="$unhash_name"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
and create a minimal input sample _with_ an element having a Target attribute, as in
<root>
<entry>
<CrossReference xrefLabel="ADDF32 RaH, #16FHi, RbH" href="#ADDF32RaH16FRbH"/>
<br Placement="line"/>
<CrossReference xrefLabel="ADDF32 RaH, RbH, #16FHi" href="#ADDF32RaHRbH16F"/>
</entry>
<foo Target="ADDF32RaHRbH16F"/>
</root>
then Saxon 6.5 outputs
So something is different in your samples, you will need to post minimal but complete samples allowing us to reproduce the problem.
Re: [xsl] Trying to check if key is NOT found
Subject: Re: [xsl] Trying to check if key is NOT found From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 13 Dec 2014 09:46:16 -0000 |
russurquhart1@xxxxxxxxxxx wrote:
Sorry about that. The xml would look like this:
<entry> <CrossReference xrefLabel="ADDF32 RaH, #16FHi, RbH" href="#ADDF32RaH16FRbH"/> <br Placement="line"/> <CrossReference xrefLabel="ADDF32 RaH, RbH, #16FHi" href="#ADDF32RaHRbH16F"/> </entry> In this case, the entry element contains two CrossReference elements. The first CrossReference element, its' href attribute does not have any element that has a Target attribute with that value.
I would expect to see:
No target for: ADDF32RaH16FRbH
Does this make more sense now?
You code does make sense but you have not shown a complete sample where you don't get a result.
For instance when I take your stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:key name="target_ref_key" match="*[@Target]" use="@Target" />
<xsl:template match="CrossReference">
<xsl:variable name="unhash_name" select="substring-after(@href, '#')"/>
<xsl:variable name="matched" select="key('target_ref_key', $unhash_name)"/>
<xsl:if test="not($matched)">
No target for:
<xsl:value-of select="$unhash_name"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
and create a minimal input sample _with_ an element having a Target attribute, as in
<root>
<entry>
<CrossReference xrefLabel="ADDF32 RaH, #16FHi, RbH" href="#ADDF32RaH16FRbH"/>
<br Placement="line"/>
<CrossReference xrefLabel="ADDF32 RaH, RbH, #16FHi" href="#ADDF32RaHRbH16F"/>
</entry>
<foo Target="ADDF32RaHRbH16F"/>
</root>
then Saxon 6.5 outputs
No target for: ADDF32RaH16FRbH
So something is different in your samples, you will need to post minimal but complete samples allowing us to reproduce the problem.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Trying to check if key is, Russell Urquhart rus | Thread | Re: [xsl] Trying to check if key is, russurquhart1@xxxxxx |
Re: [xsl] Trying to check if key is, Russell Urquhart rus | Date | Re: [xsl] Trying to check if key is, David Rudel fwqhgads |
Month |
Keywords