# Dynamically assign xml target with xpath

**URL:** <https://discuss.elastic.co/t/dynamically-assign-xml-target-with-xpath/87963>\
**Category:** Logstash\
**Created:** [June 1, 2017, 5:48pm UTC](https://discuss.elastic.co/t/dynamically-assign-xml-target-with-xpath/87963 "2017-06-01T17:48:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![timj123](https://avatars.discourse-cdn.com/v4/letter/t/eb8c5e/32.png) [@timj123](https://discuss.elastic.co/u/timj123)\
**Post date:** [June 1, 2017, 5:48pm UTC](https://discuss.elastic.co/t/dynamically-assign-xml-target-with-xpath/87963/1 "2017-06-01T17:48:58Z")

</div>

Is it possible to dynamically create an xml target based on the value of an xpath?

I can't get below to work correctly.  
I would want the value of target to be the value of the xpath:

> /measInfo/@measInfoId", "TARGET

```
  xml {
    source => "message"
    xpath => [
        "/measInfo/@measInfoId", "TARGET",
        "/measInfo/granPeriod/@endTime", "endTime"
    ] # End of xpath
    target => "%{[TARGET]}"

  } 

```

Is this possible??

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 29, 2017, 5:49pm UTC](https://discuss.elastic.co/t/dynamically-assign-xml-target-with-xpath/87963/2 "2017-06-29T17:49:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
