I 've an API Data Page with DataStructure and Method specified. Selected Method uses filter with parameter, which is specified as usually. There is also a Transformation specified, which is generating HTML Output based on DataStructure data. The question is, if I can somehow map the parameter value into the Transformation.
Thank you.
Ok. I understand and short answer is yes, it is easy.
Let take your example in steps. Say you have endpoint with a route api/messages/mID. This endpoint list detail of message according to its id. If we assume datastructure API_messages_list with default GetId filter, the parameter you need to map in the api endpint might be messages_parId. In ORIGAM architect it might look like this
To propagate the mID value also into API transformation u must have parameter with the same name inside the XSLT transformation.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:AS="http://schema.advantages.cz/AsapFunctions"
xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="AS date">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="messages_parId" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:if test="name()='ROOT'">
<mID>
<xsl:value-of select="$messages_parId" />
</mID>
</xsl:if>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
This is according to me all you need. As you then process the value of the parameter in XSLT you can handle it standard way you are used to, for example in lookups etc.
BTW this example adds element directly into ROOT, which cannot be modeled in any way through ORIGAM architect. So this is the only way how to do it.
If any more questions arise, feel free to ask. I appreciate your likes and solution marking in advance.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

