[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to restrict xsl:key

Subject: Re: How to restrict xsl:key
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Sep 2019 21:59:41 -0000
Re:  How to restrict xsl:key
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.