|
Subject: Re: [xsl] Trying to check if key is NOT found From: "russurquhart1@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 12 Dec 2014 21:15:53 -0000 |
Hi Martin,
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?
Thanks, and sorry about that!
Russ
On 12/12/14, Martin Honnen martin.honnen@xxxxxx<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Consider to post an XML sample as well together with the result you want and the one you get.
--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.
"russurquhart1@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>schrieb:
Hi,
I have a snippet of xsl to try and look through our document xml, and let me know if a given CrossRefence href attribute does NOT contain an element with a matching Target attribute. The href attribute value is some string of characters, prefixed by a '#'. There are several elements that can have a Target attribute so i wrote my xsl like the following:
.c9Y6TC { color:#0000ff; }.c49DIK { color:#ac306d; }.c18YC0 { color:#d00020; }.c5M9S0 { color:#000090; }.c69ORU { color:#aaaba0; } <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>
I had read some place on the web that this xsl:if would work to let me know when a key did NOT find any value, but it doesn't seem to be being called. I get the xml file as it is.
Is this the correct way to do this, or is there a better way?
thanks for any help,
Russ
XSL-List info and archive
EasyUnsubscribe(by email)
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Trying to check if key is, Martin Honnen martin | Thread | Re: [xsl] Trying to check if key is, Graydon graydon@xxxx |
| Re: [xsl] Trying to check if key is, Ihe Onwuka ihe.onwuk | Date | Re: [xsl] Trying to check if key is, russurquhart1@xxxxxx |
| Month |