--- a/src/XPathHandler.h Wed Dec 30 01:28:45 2020 +0100
+++ b/src/XPathHandler.h Wed Dec 30 01:37:41 2020 +0100
@@ -49,6 +49,7 @@
std::vector<relpipe::reader::handlers::AttributeMetadata> currentReaderMetadata;
std::vector<relpipe::writer::AttributeMetadata> currentWriterMetadata;
size_t currentAttributeIndex = 0;
+ size_t currentRecordNumber = 1;
xmlpp::DomParser dom;
@@ -117,6 +118,8 @@
currentReaderMetadata = attributes;
currentWriterMetadata.clear();
+ currentRecordNumber = 1;
+ recordElement = nullptr;
if (currentRelationConfiguration == nullptr) {
copyInputAttributesToOutput();
@@ -142,6 +145,10 @@
attributeElement->set_attribute("type", s2x(attributeMetadata.getTypeName()));
attributeElement->add_child_text(s2x(value));
+ if (currentAttributeIndex == 0) {
+ recordElement->set_attribute("number", std::to_string(currentRecordNumber));
+ }
+
currentAttributeIndex++;
if (currentAttributeIndex == currentReaderMetadata.size()) {
@@ -153,6 +160,7 @@
resetRecordElement();
currentAttributeIndex = 0;
+ currentRecordNumber++;
}
} else {
relationalWriter->writeAttribute(value);