I've been trying to select from the embedded XML file, to utilise for a transform. Essentially I want to get whatever value is currently "Requirements Document"
<?xml version="1.0" encoding="UTF-8"?>
<REQ-IF xmlns="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd" xmlns:configuration="http://eclipse.org/rmf/pror/toolextensions/1.0">
<THE-HEADER>
<REQ-IF-HEADER IDENTIFIER="rmf-8643a52b-b85b-4c9f-ada6-ef78c553fe6a">
<COMMENT>Created by: me</COMMENT>
<CREATION-TIME>2015-06-11T10:47:09.049+01:00</CREATION-TIME>
<REQ-IF-TOOL-ID>ProR (http://pror.org)</REQ-IF-TOOL-ID>
<REQ-IF-VERSION>1.0</REQ-IF-VERSION>
<SOURCE-TOOL-ID>ProR (http://pror.org)</SOURCE-TOOL-ID>
</REQ-IF-HEADER>
</THE-HEADER>
<CORE-CONTENT>
<REQ-IF-CONTENT>
<DATATYPES>
<DATATYPE-DEFINITION-STRING IDENTIFIER="_ceAssxAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00" LONG-NAME="T_String32k" MAX-LENGTH="32000"/>
</DATATYPES>
<SPEC-TYPES>
<SPEC-OBJECT-TYPE IDENTIFIER="_ceAstBAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00" LONG-NAME="Requirement Type">
<SPEC-ATTRIBUTES>
<ATTRIBUTE-DEFINITION-STRING IDENTIFIER="_ceAstRAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00" LONG-NAME="Description">
<TYPE>
<DATATYPE-DEFINITION-STRING-REF>_ceAssxAWEeWbqPmdfLAZ1w</DATATYPE-DEFINITION-STRING-REF>
</TYPE>
</ATTRIBUTE-DEFINITION-STRING>
</SPEC-ATTRIBUTES>
</SPEC-OBJECT-TYPE>
<SPECIFICATION-TYPE IDENTIFIER="_ceAsthAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00" LONG-NAME="Specification Type">
<SPEC-ATTRIBUTES>
<ATTRIBUTE-DEFINITION-STRING IDENTIFIER="_ceBTwBAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00" LONG-NAME="Description">
<TYPE>
<DATATYPE-DEFINITION-STRING-REF>_ceAssxAWEeWbqPmdfLAZ1w</DATATYPE-DEFINITION-STRING-REF>
</TYPE>
</ATTRIBUTE-DEFINITION-STRING>
</SPEC-ATTRIBUTES>
</SPECIFICATION-TYPE>
</SPEC-TYPES>
<SPEC-OBJECTS>
<SPEC-OBJECT IDENTIFIER="_ceBTwRAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:34.958+01:00">
<VALUES>
<ATTRIBUTE-VALUE-STRING THE-VALUE="This is a single SpecObject">
<DEFINITION>
<ATTRIBUTE-DEFINITION-STRING-REF>_ceAstRAWEeWbqPmdfLAZ1w</ATTRIBUTE-DEFINITION-STRING-REF>
</DEFINITION>
</ATTRIBUTE-VALUE-STRING>
</VALUES>
<TYPE>
<SPEC-OBJECT-TYPE-REF>_ceAstBAWEeWbqPmdfLAZ1w</SPEC-OBJECT-TYPE-REF>
</TYPE>
</SPEC-OBJECT>
</SPEC-OBJECTS>
<SPECIFICATIONS>
<SPECIFICATION IDENTIFIER="_ceBTwxAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00" LONG-NAME="Specification Document">
<VALUES>
<ATTRIBUTE-VALUE-STRING THE-VALUE="Requirements Document">
<DEFINITION>
<ATTRIBUTE-DEFINITION-STRING-REF>_ceBTwBAWEeWbqPmdfLAZ1w</ATTRIBUTE-DEFINITION-STRING-REF>
</DEFINITION>
</ATTRIBUTE-VALUE-STRING>
</VALUES>
<TYPE>
<SPECIFICATION-TYPE-REF>_ceAsthAWEeWbqPmdfLAZ1w</SPECIFICATION-TYPE-REF>
</TYPE>
<CHILDREN>
<SPEC-HIERARCHY IDENTIFIER="_ceBTxRAWEeWbqPmdfLAZ1w" LAST-CHANGE="2015-06-11T10:47:09.049+01:00">
<OBJECT>
<SPEC-OBJECT-REF>_ceBTwRAWEeWbqPmdfLAZ1w</SPEC-OBJECT-REF>
</OBJECT>
</SPEC-HIERARCHY>
</CHILDREN>
</SPECIFICATION>
</SPECIFICATIONS>
</REQ-IF-CONTENT>
</CORE-CONTENT>
<TOOL-EXTENSIONS>
<REQ-IF-TOOL-EXTENSION>
<configuration:ProrToolExtension>
<configuration:specViewConfigurations>
<configuration:ProrSpecViewConfiguration specification="_ceBTwxAWEeWbqPmdfLAZ1w">
<configuration:columns>
<configuration:Column label="Description" width="400"/>
</configuration:columns>
<configuration:leftHeaderColumn>
<configuration:Column label="Lead Header Column" width="30"/>
</configuration:leftHeaderColumn>
</configuration:ProrSpecViewConfiguration>
</configuration:specViewConfigurations>
<configuration:generalConfiguration>
<configuration:ProrGeneralConfiguration>
<configuration:labelConfiguration>
<configuration:LabelConfiguration>
<defaultLabel>Description</defaultLabel>
</configuration:LabelConfiguration>
</configuration:labelConfiguration>
</configuration:ProrGeneralConfiguration>
</configuration:generalConfiguration>
</configuration:ProrToolExtension>
</REQ-IF-TOOL-EXTENSION>
</TOOL-EXTENSIONS>
</REQ-IF>
using something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="REQ-IF/CORE-CONTENT/REQ-IF-CONTENT/SPECIFICATIONS[@LONG-NAME='Specification Document']/VALUES">
<xsl:value-of select="ATTRIBUTE-VALUE-STRING THE-VALUE">
</xsl:value-of>
</xsl:template>
but I cannot see where I'm going wrong? I've been reading a lot on the template match and value-of, but seem to go round in circles.
If I can see how to do this once, I'll be comfortable with this.
There are many ways to do that, this is one example :
Notice that your XML has default namespace so you need to declare prefix that point to the default namespace uri and use that prefix (
d:
in my example above) throughout your xpath expressions. Don't forget to add default namespace prefix in theexclude-result-prefixes
list.output :
side note: wildcards (
*
) used in place of the actual element names in above example just to shorten the xpath.