Я пытаюсь переместить элементы только в дочерних записях.Когда я запускаю xsl против одного сотрудника, результаты будут такими, как хотелось бы.Однако запуск xsl для двух или более сотрудников приводит к нежелательным результатам.
xml
<?xml version='1.0' encoding='UTF-8'?>
<xx:Payroll_Extract_Employees xmlns:xx="urn:com.me/a">
<xx:PayGroup>
<xx:Header>
<xx:recs>2</xx:recs>
</xx:Header>
<xx:Employee>
<xx:Summary>
<xx:Employee_ID>0000000aa</xx:Employee_ID>
</xx:Summary>
<xx:Position>
<xx:Position_ID xx:PriorValue="">Pos1</xx:Position_ID>
<xx:Organization_One xx:PriorValue="">bad1</xx:Organization_One>
<xx:Organization_Three xx:PriorValue="">good1</xx:Organization_Three>
</xx:Position>
<xx:Additional_Information>
<xx:Payroll_ID xx:PriorValue="">a001</xx:Payroll_ID>
<xx:Organization_One xx:PriorValue="a">aa1</xx:Organization_One>
<xx:Organization_Two xx:PriorValue="a">aa2</xx:Organization_Two>
<xx:Organization_Four xx:PriorValue="a">aa3</xx:Organization_Four>
</xx:Additional_Information>
</xx:Employee>
<xx:Employee>
<xx:Summary>
<xx:Employee_ID>0000000bb</xx:Employee_ID>
</xx:Summary>
<xx:Position>
<xx:Position_ID xx:PriorValue="">Pos2</xx:Position_ID>
<xx:Organization_One xx:PriorValue="">bad2</xx:Organization_One>
<xx:Organization_Three xx:PriorValue="">good2</xx:Organization_Three>
</xx:Position>
<xx:Additional_Information>
<xx:Payroll_ID xx:PriorValue="">b001</xx:Payroll_ID>
<xx:Organization_One xx:PriorValue="b">bb1</xx:Organization_One>
<xx:Organization_Two xx:PriorValue="b">bb2</xx:Organization_Two>
<xx:Organization_Four xx:PriorValue="b">bb3</xx:Organization_Four>
</xx:Additional_Information>
</xx:Employee>
</xx:PayGroup>
</xx:Payroll_Extract_Employees>
xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xx="urn:com.me/a">
<!-- Identity transform -->
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xx:Employee_ID">
<xsl:copy-of select="."/>
<xsl:copy-of
Select="/xx:Payroll_Extract_Employees/xx:PayGroup/xx:Employee
/xx:Additional_Information/xx:Payroll_ID"/>
</xsl:template>
<xsl:template match="xx:Position/xx:Organization_One"></xsl:template>
<xsl:template match="xx:Position/xx:Position_ID">
<xsl:copy-of select="."/>
<xsl:copy-of select="//xx:Additional_Information/xx:Organization_One"/>
<xsl:copy-of select="//xx:Additional_Information/xx:Organization_Two"/>
<xsl:copy-of select="//xx:Additional_Information/xx:Organization_Four"/>
</xsl:template>
</xsl:stylesheet>
Вывод:
<?xml version="1.0" encoding="UTF-8"?>
<xx:Payroll_Extract_Employees xmlns:xx="urn:com.me/a">
<xx:PayGroup>
<xx:Header>
<xx:recs>2</xx:recs>
</xx:Header>
<xx:Employee>
<xx:Summary>
<xx:Employee_ID>0000000aa</xx:Employee_ID>
<xx:Payroll_ID xx:PriorValue="">a001</xx:Payroll_ID>
<xx:Payroll_ID xx:PriorValue="">b001</xx:Payroll_ID>
</xx:Summary>
<xx:Position>
<xx:Position_ID xx:PriorValue="">Pos1</xx:Position_ID>
<xx:Organization_One xx:PriorValue="a">aa1</xx:Organization_One>
<xx:Organization_One xx:PriorValue="b">bb1</xx:Organization_One>
<xx:Organization_Two xx:PriorValue="a">aa2</xx:Organization_Two>
<xx:Organization_Two xx:PriorValue="b">bb2</xx:Organization_Two>
<xx:Organization_Four xx:PriorValue="a">aa3</xx:Organization_Four>
<xx:Organization_Four xx:PriorValue="b">bb3</xx:Organization_Four>
<xx:Organization_Three xx:PriorValue="">good1</xx:Organization_Three>
</xx:Position>
<xx:Additional_Information>
<xx:Payroll_ID xx:PriorValue="">a001</xx:Payroll_ID>
<xx:Organization_One xx:PriorValue="a">aa1</xx:Organization_One>
<xx:Organization_Two xx:PriorValue="a">aa2</xx:Organization_Two>
<xx:Organization_Four xx:PriorValue="a">aa3</xx:Organization_Four>
</xx:Additional_Information>
</xx:Employee>
<xx:Employee>
<xx:Summary>
<xx:Employee_ID>0000000bb</xx:Employee_ID>
<xx:Payroll_ID xx:PriorValue="">a001</xx:Payroll_ID>
<xx:Payroll_ID xx:PriorValue="">b001</xx:Payroll_ID>
</xx:Summary>
<xx:Position>
<xx:Position_ID xx:PriorValue="">Pos2</xx:Position_ID>
<xx:Organization_One xx:PriorValue="a">aa1</xx:Organization_One>
<xx:Organization_One xx:PriorValue="b">bb1</xx:Organization_One>
<xx:Organization_Two xx:PriorValue="a">aa2</xx:Organization_Two>
<xx:Organization_Two xx:PriorValue="b">bb2</xx:Organization_Two>
<xx:Organization_Four xx:PriorValue="a">aa3</xx:Organization_Four>
<xx:Organization_Four xx:PriorValue="b">bb3</xx:Organization_Four>
<xx:Organization_Three xx:PriorValue="">good2</xx:Organization_Three>
</xx:Position>
<xx:Additional_Information>
<xx:Payroll_ID xx:PriorValue="">b001</xx:Payroll_ID>
<xx:Organization_One xx:PriorValue="b">bb1</xx:Organization_One>
<xx:Organization_Two xx:PriorValue="b">bb2</xx:Organization_Two>
<xx:Organization_Four xx:PriorValue="b">bb3</xx:Organization_Four>
</xx:Additional_Information>
</xx:Employee>
</xx:PayGroup>
</xx:Payroll_Extract_Employees>
Для сотрудника 1 я не хочу, чтобы какое-либо значение начиналось с «b», а для сотрудника 2 я не хочу, чтобы какое-либо значение начиналось с «a».
Существует ли простой параметр, который можнодобавлено ограничение использования шаблонов сотрудником сотрудником?