Alnedru
Alnedru

Reputation: 2655

XSLT array contains set from other array

I have a question imagine i have following xml:

  <dsQueryResponse>
    <Work_Description>
      <Rows>
        <Row SId="{6EB1996C-8629-4BF9-92CA-956551E8D10D}" Title="DemoV1" />
        <Row SId="{6819144E-A9B7-4611-A694-7D2EDBF910A7}" Title="Template 1" />
        <Row SId="{2E56B932-F197-4335-AE92-1B5BF23D3EA4}" Title="Template 2"  />
      </Rows>
    </Work_Description>
    <Reports>
      <Rows>
        <Row SId="{6EB1996C-8629-4BF9-92CA-956551E8D10D}" Title="Reports" />
        <Row SId="{6EB1996C-8629-4BF9-92CA-956551E8D103}" Title="Reports 2" />
        <Row SId="{6EB1996C-8629-4BF9-92CA-956551E8D10S}" Title="Reports 3" />
        <Row SId="{6EB1996C-8629-4BF9-92CA-956551E8D10A}" Title="Reports 4" />
      </Rows>
    </Reports>
  </dsQueryResponse>

and in my XSLT i have following:

  <xsl:variable name="AllProjects" select="/dsQueryResponse/Work_Description/Rows/Row"/>
  <xsl:variable name="AllReports" select="/dsQueryResponse/Reports/Rows/Row"/>

Now i have this 2 arrays how can I get another array filtered where all description rows where repots SId = work SId. It should be something like this: <xsl:variable="Filtered" select="AllProjects[@SId=$AllReports/@SId]" />

Upvotes: 0

Views: 135

Answers (1)

Erlock
Erlock

Reputation: 1968

I'm not sure I completely understand your problem... But this is working:

<xsl:variable name="Filtered" select="$AllProjects[@SId=$AllReports/@SId]" />
<xsl:copy-of select="$Filtered"/>

Upvotes: 1

Related Questions