Subject: Re: [xsl] How to restrict xsl:key From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 12 Sep 2019 21:59:41 -0000 |
It looks as if this can be done simply by changing the match attribute to match="Period[@domain='c']//Stamp" Or have I misunderstood? Michael Kay Saxonica > On 12 Sep 2019, at 22:55, Mark Wilson mark@xxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > I have established a key: > <xsl:key name="placement-index" match="Stamp" use="concat(CatNumbers/@pofis-prefix, CatNumbers/@pofis-number, CatNumbers/@pofis-suffix)"/> > > It uses an XML file that contains the element Stamp. It worked until today. What changed is that the CatNumbers fall into two Periods (seedata below). Until today, the Catnumbers referenced always fell in Period domain='c' in my data. They now also fall into Period domain='cr'. I need to restrict the output of the template to only keys built from the @domain='c' part of the data. Have not a clue how to do this. > > The code using building and using the key is: > > <xsl:key name="placement-index" match="Stamp" use="concat(CatNumbers/@pofis-prefix, CatNumbers/@pofis-number, CatNumbers/@pofis-suffix)"/> > > <xsl:template match="Flaws"> > <Flaws> > <xsl:attribute name="placement-index" select="key('placement-index', concat(@pofis-prefix, @pofis-number, @pofis-suffix), doc('../work/data-with-index.xml'))/@placement-index" > /> > <xsl:attribute name="flaw-width" select="key('placement-index', concat(@pofis-prefix, @pofis-number, @pofis-suffix), doc('../work/data-with-index.xml'))/@flaw-width" > /> > <xsl:copy-of select="@*"/> > <xsl:copy-of select="node()"/> > </Flaws> > </xsl:template> > > > The data is: > <Period domain="c"> > <Year year="1918"> > <Month month="12"> > <Day day="18"> > <Set> > <Motif concept="Definitive Issues"/> > <Stamp> > <CatNumbers scott-number="2" pofis-number="3"/> > <Value kc-value="0" h-value="5"/> > <Inscriptions czech="$" eng="$"/> > <Formats other="3"/> > <Formats gutter="3"/> > </Stamp> > <Stamp> > <CatNumbers scott-number="3" pofis-number="5"/> > <Value kc-value="0" h-value="10"/> > <Inscriptions czech="$" eng="$"/> > <Formats other="5"/> > <Formats gutter="5"/> > </Stamp> > </Set> > ... > <Period/> > <Period domain="cr"> > <Year year="1918"> > <Month month="12"> > <Day day="18"> > <Set> > <Motif concept="Definitive Issues"/> > <Stamp> > <CatNumbers scott-number="2" pofis-number="3"/> > <Value kc-value="0" h-value="5"/> > <Inscriptions czech="$" eng="$"/> > <Formats other="3"/> > <Formats gutter="3"/> > </Stamp> > <Stamp> > <CatNumbers scott-number="3" pofis-number="5"/> > <Value kc-value="0" h-value="10"/> > <Inscriptions czech="$" eng="$"/> > <Formats other="5"/> > <Formats gutter="5"/> > </Stamp> > </Set> > ... > <Period/>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to restrict xsl:key, Mark Wilson mark@xxx | Thread | Re: [xsl] How to restrict xsl:key, Mark Wilson mark@xxx |
[xsl] How to restrict xsl:key, Mark Wilson mark@xxx | Date | Re: [xsl] How to restrict xsl:key, Mark Wilson mark@xxx |
Month |