With the workflow component, Resource to workflow variable (which is a shortcut component of the other category), you can read a resource from the library and store it in a workflow variable. A related component is: From file to workflow variable.
The component has these parameters:
Content type
The "content type" select the resource type that you want to read from the Library. You can select the type from the drop down list or even click on the icon on the right to build an XPath expression, that returns the type. The type refer to the "sub-folders" of the library.
Path and file name
The "path and filename" set the path and filename of the resource that you want to read. The path is the relative path from the Library folder selected as the content type above.
Variable name
Variable name sets the name of the workflow variable, that you want to store this resource in.
Note that when reading the resource types document, transformation, translation and validation rule, then the resources will be read as text. If the document is not using UTF-8 character set, then you may encounter encoding issues. Other resource types are read as binary data.
You can verify the contents of the variable afterwards e.g. with the debug headers component.
A common use case for the "resource to workflow variable" component, is to merge two or more XML files with an XSL transformation. In this case you could have one XML as the payload and the others as workflow variables.
For instance if you read the second XML into a workflow variable "SecondXML", then you can append that with the payload with this transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:param name="SecondXML" />
<xsl:template match="/">
<root>
<xsl:copy-of select="fn:parse-xml($SecondXML)" />
<xsl:copy-of select="." /> <!-- This is the root node in the payload XML -->
</root>
</xsl:template>
</xsl:stylesheet>