2012-10-11 2 views
1

다음과 같은 XML 문서가 있습니다. record_type = 'VALID'일 때 각 LOCATION_NAME 및 FILE_TYPE에 대한 레코드 수를 가져와야합니다. LOCATION_NAME 및 FILY_TYPE은 (는) 매개 변수에 있습니다. 그 두 매개 변수에 대해, 나는 RECORD_TYPE = 'VALID'일 때 레코드 수를 얻어야 만한다.XSLT를 사용하여 2 개의 매개 변수 값과 record_type = 'VALID'을 전달하여 레코드 수를 가져와야합니다.

각 반복 (루프)마다 하나의 LOCATION_NAME 및 하나의 FILY_TYPE을 제공하므로 계산할 필요가 있습니다. 입력 매개 변수는 외부 시스템에 전달됩니다 (이 경우 Tibco JDBC QUERY 결과). 제가 1 LOCATION_NAME = XYZ XYZ 및 FILE_TYPE = 'STOSI'그때 가야 valid_rec_count = 1 2 LOCATION_NAME = XYZ EL 및 FILE_TYPE가 = 'STOIV'그때 가야 valid_rec_count를 제공하는 경우, 예를 들면

<root> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>1</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>2</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>3</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>WARNING</RECORD_TYPE> 
    <RECORD_NO>3</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>4</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>6</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>7</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>8</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>9</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SellOutRecord> 
<SellOutRecord> 
    <FILE_TYPE>STOSO</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>10</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SellOutRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>2</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</InventoryRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>4</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</InventoryRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>5</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</InventoryRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>8</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</InventoryRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>9</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</InventoryRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>11</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</InventoryRecord> 
<InventoryRecord> 
    <FILE_TYPE>STOIV</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>14</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</InventoryRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>1</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>2</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>3</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>WARNING</RECORD_TYPE> 
    <RECORD_NO>3</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>4</RECORD_NO> 
    <LOCATION_NAME>XYZ el</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>7</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>VALID</RECORD_TYPE> 
    <RECORD_NO>8</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>WARNING</RECORD_TYPE> 
    <RECORD_NO>8</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SalesInRecord> 
<SalesInRecord> 
    <FILE_TYPE>STOSI</FILE_TYPE> 
    <RECORD_TYPE>ERROR</RECORD_TYPE> 
    <RECORD_NO>10</RECORD_NO> 
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME> 
</SalesInRecord> 
</root> 

= 2

답변

2

사용 :

count(/*/*[RECORD_TYPE='VALID'] 
      [FILE_TYPE = $pfileType and LOCATION_NAME = $pLocname] 
    )