I want to copy nodes from parent to the child. I am not really sure how this can be acheived.
My source xml
<Root1>
<Family1>
<Childrens>
<Child>
<ChildFirstName>Robin1</ChildFirstName>
<ChildLastName>Jackman1</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin2</ChildFirstName>
<ChildLastName>Jackman2</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
</Childrens>
</Family1>
</Root1>
I would like to get the output as
<Root1>
<Family1>
<Childrens>
<Child>
<ChildFirstName>Robin1</ChildFirstName>
<ChildLastName>Jackman1</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
<ChildFirstName>Robin1</ChildFirstName>
<ChildLastName>Jackman1</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin2</ChildFirstName>
<ChildLastName>Jackman2</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
<ChildFirstName>Robin2</ChildFirstName>
<ChildLastName>Jackman2</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
</Childrens>
</Family1>
</Root1>
I want the solution in XSLT 1.0.
I want to copy these nodes to child nodes
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
Thanks.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="#* | node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/OrderItem/ProductionInformation/GSItem">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
<xsl:for-each select="/OrderItem">
<xsl:apply-templates select="#*|node()[name()!='ProductionInformation']"/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Related
I am trying to develop a hierarchical structure from a flat file thus i need to establish parent child relationship in the desired output. Could you please suggest a method in XSLT 2.0.
Please find below the input XML which contains LEVEL and IDENTIFY tags on the basis of which i was trying to build the parent child relationship.
All the IDENTIFY tags with 'IB' should be in a separate tag like LOCATION and all the IDENTIFY tags with 'ER' should be in a separate tag like ADDRESS in output.
Input XML:
<Path>
<item>
<LEVEL>1</LEVEL>
<RANK>340</RANK>
<TYPE>T</TYPE>
<DESC>Sheet</DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC> Handler</DESC>
<NAME>D</NAME>
<IDENTIFY></IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>341</RANK>
<TYPE>M</TYPE>
<DESC>handler </DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>pdf</DESC>
<NAME>D</NAME>
<IDENTIFY></IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>330</RANK>
<TYPE>M</TYPE>
<DESC>SERVO </DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>331</RANK>
<TYPE>M</TYPE>
<DESC>SENSOR</DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>342</RANK>
<TYPE>M</TYPE>
<DESC>xyz</DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>335</RANK>
<TYPE>M</TYPE>
<DESC>FILTER</DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>343</RANK>
<TYPE>M</TYPE>
<DESC>safety </DESC>
<NAME>I</NAME>
<IDENTIFY>IB</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>doc</DESC>
<NAME>D</NAME>
<IDENTIFY></IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>337</RANK>
<TYPE>M</TYPE>
<DESC>ROD </DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>338</RANK>
<TYPE>M</TYPE>
<DESC>CYL</DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>3</LEVEL>
<RANK>339</RANK>
<TYPE>M</TYPE>
<DESC>COMPRESSION </DESC>
<NAME>L</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
<item>
<LEVEL>2</LEVEL>
<RANK>345</RANK>
<TYPE>M</TYPE>
<DESC>Nylon</DESC>
<NAME>I</NAME>
<IDENTIFY>ER</IDENTIFY>
</item>
</Path>
Desired Output:
<LOCATION>
<LEVEL>1</LEVEL>
<RANK>340</RANK>
<TYPE>T</TYPE>
<DESC>Sheet</DESC>
<NAME>I</NAME>
</LOCATION>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC> Handler</DESC>
<NAME>D</NAME>
</LOCATION>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>341</RANK>
<TYPE>M</TYPE>
<DESC> handler </DESC>
<NAME>I</NAME>
</LOCATION>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>pdf</DESC>
<NAME>D</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>330</RANK>
<TYPE>M</TYPE>
<DESC>pqr</DESC>
<NAME>L</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>331</RANK>
<TYPE>M</TYPE>
<DESC>SENSOR</DESC>
<NAME>L</NAME>
</ADDRESS>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>342</RANK>
<TYPE>M</TYPE>
<DESC>xyz</DESC>
<NAME>I</NAME>
</LOCATION>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>335</RANK>
<TYPE>M</TYPE>
<DESC>TER</DESC>
<NAME>L</NAME>
</ADDRESS>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>343</RANK>
<TYPE>M</TYPE>
<DESC>SAFE</DESC>
<NAME>I</NAME>
</LOCATION>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK/>
<TYPE>M</TYPE>
<DESC>doc</DESC>
<NAME>D</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>337</RANK>
<TYPE>M</TYPE>
<DESC>RST/DESC>
<NAME>L</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>338</RANK>
<TYPE>M</TYPE>
<DESC>CYL</DESC>
<NAME>L</NAME>
</ADDRESS>
<ADDRESS>
<LEVEL>3</LEVEL>
<RANK>339</RANK>
<TYPE>M</TYPE>
<DESC>COMP</DESC>
<NAME>L</NAME>
</ADDRESS>
<LOCATION>
<LEVEL>2</LEVEL>
<RANK>345</RANK>
<TYPE>M</TYPE>
<DESC>Nyl</DESC>
<NAME>I</NAME>
</LOCATION>
i have xml with similar structure:
<Info>
<parents>
<parent1>
<id>1</id>
</parent1>
<parent2>
<id>2</id>
</parent2>
</parents>
<children>
<child>
<id>1</id>
<parentID>
1
</parentID>
<someInfoFromOneNode>
qqq
</someInfoFromOneNode>
</child>
<child>
<id>1</id>
<parentID>
1
</parentID>
<someInfoFromAnOtherNode>
qqq
</someInfoFromAnOtherNode>
</child>
<child>
<id>2</id>
<parentID>
2
</parentID>
<someInfoFromOneNode>
qqq
</someInfoFromOneNode>
</child>
<child>
<id>2</id>
<parentID>
2
</parentID>
<someInfoFromAnOtherNode>
qqq
</someInfoFromAnOtherNode>
</child>
</children>
</Info>
i need to get xml with that structure:
<Info>
<parent>
<id>1</id>
<children>
<chidl>
<id>1</id>
<someInfoFromOneNode>
qqq
</someInfoFromOneNode>
<someInfoFromAnOtherNode>
qqq
</someInfoFromAnOtherNode>
</chidl>
</children>
</parent>
<parent>
<id>2</id>
<children>
<chidl>
<id>2</id>
<someInfoFromOneNode>
qqq
</someInfoFromOneNode>
<someInfoFromAnOtherNode>
qqq
</someInfoFromAnOtherNode>
</chidl>
</children>
</parent>
</Info>
So i need to collect all children of one parent and in addition collect info related to one child. I've tried to filter children like this and displayed at least children ids(i keep the parentId):
<children>
<xsl:for-each select="/Info/children/child">
<xsl:if test="./price_groups_id = $parentId and not(./id = preceding-sibling::id)">
<child>
<id>
<xsl:value-of select="./id"/>
</id
</child>
</xsl:if>
</xsl:for-each>
</children>
But it only filters children by parent id and duplicate them, so current result is that:
<Info>
<parent>
<id>1</id>
<children>
<child>
<id>1</id>
</child>
<child>
<id>1</id>
</child>
</children>
</parent>
<parent>
<id>2</id>
<children>
<child>
<id>2</id>
</child>
<child>
<id>2</id>
</child>
</children>
</parent>
</Info>
What can i do to check previous node id and filter by it?
I'm trying to generate a report, using Jasper iReport Designer 5.6.0, with table that contains lists inside its cells. The generated table could look like this:
To do this, I'm using the following XML file as datasource:
<report>
<table>
<persons>
<person>
<id>111</id>
<name>John</name>
<addresses>
<address>Johan's Street 1</address>
<address>Johan's Street 2</address>
<address>Johan's Street 3</address>
</addresses>
</person>
<person>
<id>222</id>
<name>Marko</name>
<addresses>
<address>Marko's Street 1</address>
<address>Marko's Street 2</address>
</addresses>
</person>
<person>
<id>333</id>
<name>Tito</name>
<addresses>
<address>Tito's Street 1</address>
<address>Tito's Street 2</address>
<address>Tito's Street 3</address>
<address>Tito's Street 4</address>
</addresses>
</person>
</persons>
</table>
</report>
And JRXML template:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TableWithList" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2347c131-1884-430a-b77f-59f08f896c8a">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="PersonsTable" uuid="1470ca7f-50f9-4781-9af7-ed3e04841738">
<queryString language="xPath">
<![CDATA[/report/table/persons/person]]>
</queryString>
<field name="person" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
<field name="id" class="java.lang.String">
<fieldDescription><![CDATA[id]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[name]]></fieldDescription>
</field>
</subDataset>
<subDataset name="AddressesList" uuid="5c62f1af-dfc1-49ca-8615-493009f964f6">
<queryString language="xPath">
<![CDATA[/report/table/persons/person/addresses]]>
</queryString>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/report]]>
</queryString>
<detail>
<band height="175" splitType="Stretch">
<componentElement>
<reportElement key="table" x="0" y="0" width="308" height="50" uuid="d3ef2b70-5a74-4ebf-85f5-36fbcac91938"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="PersonsTable" uuid="41f6ef78-fb40-4d6f-9998-e31689321fc8">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/report/table/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:column width="122" uuid="3bbeb837-7663-4af6-b2f4-759be2c88102">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="122" height="30" uuid="3bc07e10-17f3-45ea-8df9-69a3968dc689"/>
<text><![CDATA[NAMES]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="33" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="122" height="33" uuid="9d26eb70-a1bc-443c-8fd1-25bcefc6dd58"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="185" uuid="1f779e6e-316b-4442-8e36-c020b7b50d6b">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="185" height="30" uuid="59998a31-67a7-4ebe-bd15-6f6d3ec38231"/>
<text><![CDATA[ADDRESSES]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="33" rowSpan="1">
<componentElement>
<reportElement x="0" y="0" width="185" height="33" uuid="e6ed252e-e104-489d-bf10-b3ffb0f3ad0e"/>
<jr:list printOrder="Vertical">
<datasetRun subDataset="AddressesList" uuid="03bc1640-16e7-4111-b48a-0b77e01baefa">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/report/table/persons/person/addresses")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="33" width="185">
<textField>
<reportElement x="0" y="0" width="185" height="33" uuid="eb98e95f-d395-4404-a77b-1660f1de9fd0"/>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
And this is what I'm getting as resulting report:
Is it possible to have a list element inside the table element? If yes, what I'm doing wrong?
You are close
Your <subDataset name="PersonsTable"> is correct!
Your <subDataset name="AddressesList"> should be
<subDataset name="AddressesList" uuid="5c62f1af-dfc1-49ca-8615-493009f964f6">
<queryString language="xPath">
<![CDATA[/report/table/persons/person/addresses/address]]>
</queryString>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
</subDataset>
You need to arrive to node address
Since your person table already works we need only to fix the dataSourceExpression for the <jr:list>
<datasetRun subDataset="AddressesList" uuid="c8e1bd7e-b4d8-4e48-8b06-e8fd59846d69">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/addresses/address")]]></dataSourceExpression>
</datasetRun>
Thats it
I want to copy nodes from parent to the child. I am not really sure how this can be acheived.
My source xml
<Root1>
<Family1>
<Childrens>
<Child>
<ChildFirstName>Robin1</ChildFirstName>
<ChildLastName>Jackman1</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin2</ChildFirstName>
<ChildLastName>Jackman2</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
</Childrens>
</Family1>
</Root1>
I would like to get the output as
<Root1>
<Family1>
<Childrens>
<Child>
<ChildFirstName>Robin1</ChildFirstName>
<ChildLastName>Jackman1</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
<ChildFirstName>Robin1</ChildFirstName>
<ChildLastName>Jackman1</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin2</ChildFirstName>
<ChildLastName>Jackman2</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
<ChildFirstName>Robin2</ChildFirstName>
<ChildLastName>Jackman2</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
<Child>
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
<Activities>
<Sports>
<Cricket>
<ParticipentNames>
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
</ParticipentNames>
</Cricket>
</Sports>
</Activities>
</Child>
</Childrens>
</Family1>
</Root1>
I want the solution in XSLT 1.0.
I want to copy these nodes to child nodes
<ChildFirstName>Robin3</ChildFirstName>
<ChildLastName>Jackman3</ChildLastName>
<Address>
<Street1>Street1</Street1>
<State>State</State>
<Country>Country</Country>
</Address>
Thanks.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="#* | node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="ParticipentNames">
<xsl:copy>
<xsl:apply-templates select="ancestor::Child/ChildFirstName | ancestor::Child/ChildLastName | ancestor::Child/Address"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
should suffice (might want to add <xsl:output indent="yes"/> and <xsl:strip-space elements="*"/> for better formatting).
I'm trying to transform my xml file:
<root>
<group id="F_123" >
<term id="F_123_d" >
<word>blabla</word>
<instruction>blabla</instruction>
</term>
<term id="F_123">
<word>blabla</word>
<instruction>blabla</instruction>
<numbers>
<number code="01" >1</number>
<number code="02" >2</number>
<number code="03" >3</number>
<number code="04" >4</number>
<number code="05" >5</number>
</numbers>
</term>
<term id="F_124">
<word>blabla</word>
<numbers>
<number code="01" >1</number>
<number code="02" >2</number>
<number code="03" >3</number>
<number code="04" >4</number>
<number code="05" >5</number>
</numbers>
</term>
<term id="F_125">
<word>blabla</word>
<numbers>
<number code="01" >1</number>
<number code="02" >2</number>
<number code="03" >3</number>
<number code="04" >4</number>
<number code="05" >5</number>
</numbers>
</term>
<routing id="F_123_1">
<condition>
<operator type="or">
<operator type="or">
<operator type="equal">
<variable name="F_D01a3DE1"/>
<constant>DK</constant>
</operator>
<operator type="equal">
<variable name="F_D01a3DE1"/>
<constant>RF</constant>
</operator>
</operator>
<operator type="equal">
<variable name="F_D01a3DE1"/>
<constant>1</constant>
</operator>
</operator>
</condition>
<then>
<goto group="A_24"/>
</then>
<else>
<routing>
<condition>
<operator type="or">
<operator type="or">
<operator type="equal">
<variable name="B_D01a3DE1"/>
<constant>5</constant>
</operator>
<operator type="equal">
<variable name="B_D01a3DE1"/>
<constant>10</constant>
</operator>
</operator>
<operator type="equal">
<variable name="B_D01a3DE1"/>
<constant>7</constant>
</operator>
</operator>
</condition>
<then>
<goto group="A_25"/>
</then>
<else>
<routing>
<condition>
<operator type="or">
<operator type="equal">
<variable name="B_D01a3DE1"/>
<constant>6</constant>
</operator>
<operator type="equal">
<variable name="B_D01a3DE1"/>
<constant>11</constant>
</operator>
</operator>
</condition>
<then>
<goto group="A_26"/>
</then>
<else>
<goto group="A_27"/>
</else>
</routing>
</else>
</routing>
</else>
</routing>
</group>
<group id="A_25" >
<term id="A_25" >
<word>blabla</word>
<instruction>blabla</instruction>
</term>
<term id="A_26">
<word>blabla</word>
<instruction>blabla</instruction>
<numbers>
<number code="01" >1</number>
<number code="02" >2</number>
</numbers>
</term>
</group>
</root>
I want to access the value of #group/term/#id and make one element per each term in <group id="A_25">. Is it possible?
It's not very clear what exactly do you want, so a guess follows:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="group/term/#id">
<id>
<xsl:value-of select="."/>
</id>
</xsl:template>
<xsl:template match="/">
<root>
<xsl:apply-templates select="node()" />
</root>
</xsl:template>
<xsl:template match="node()|#*">
<xsl:apply-templates select="node()|#*" />
</xsl:template>
</xsl:stylesheet>
When applied to your example (I had to add a root element to it, so that it's valid), it produces:
<root>
<id>F_123_d</id>
<id>F_123</id>
<id>F_124</id>
<id>F_125</id>
<id>A_25</id>
<id>A_26</id>
</root>
I want to access the value of
#group/term/#id and make one element
per each term in <group id="A_25">. Is
it possible?
This XPath expression select what I think you want:
/root/group[#id='A_25']/term/#id
Also, this stylesheet process what I think you want:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="text()"/>
<xsl:template match="group[#id='A_25']/term">
<element id="{#id}"/>
</xsl:template>
</xsl:stylesheet>
Output:
<element id="A_25" />
<element id="A_26" />