-1

Here is my xslt input:-

{
    "array1": [
        {
            "id": "banglore",
            "mappingData": [
                {
                    "name": "v1"
                },
                {
                    "name": "v2",
                    "Data": [
                        {
                            "idFromIndia": "0001"
                        }
                    ]
                }
            ]
        }
    ]
}

Here I'm looking select <xsl:value-of select="concat(?idFromIndia,'|')"/>

I'm parsing input json using parse-json method;

<xsl:variable name="input-as-map" select="parse-json($input)" as="map(*)"/>

$input-as-map?array1*mappingData

I was trying to use wildcard method for traversing and i,e not working for me.

any suggestions would be helpful.......

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
vivek
  • 115
  • 2
  • 9
  • It is not clear which result you want to output, please edit your question and show exactly which format and content your result should have. – Martin Honnen Jul 28 '21 at 13:33
  • While asking an XSLT question you need to provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example): (1) Input XML. (2) Your logic, and XSLT that tried to implement it. (3) Desired output. (4) XSLT processor and its compliance with the XSLT standards: 1.0, 2.0, or 3.0. – Yitzhak Khabinsky Jul 28 '21 at 14:13
  • @YitzhakKhabinsky, while I agree the question could be improved I don't think it makes sense to ask for a mandatory XML input if the question obviously processes JSON with XPath 3.1 and XSLT 3. Even in XSLT 2 you can start with a named template without the need for an XML input document. – Martin Honnen Jul 28 '21 at 14:54
  • @MartinHonnen, without minimal repro, both question and answer are unusable for anybody outside of the OP. – Yitzhak Khabinsky Jul 28 '21 at 15:07
  • You need to elaborate a bit on which data in which format exactly you want to extract, in which context you use a snippet like `` and which error you got. – Martin Honnen Jul 29 '21 at 07:37

1 Answers1

0

<xsl:value-of select="$input-as-map?array1?*?mappingData?*?Data?*?idFromIndia"/> should give you 0001 or <xsl:value-of select="$input-as-map?array1?*?mappingData?*?Data?*?idFromIndia || '|'"/> should give you 0001|.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110