Here is a possible workaround: the idea is to include the questions but hide them, i.e., print nothing. exsheets question properties then allow to print the needed parts selectively.
Caution: The code below is a hack that uses internal functions so it may break
in future versions of exsheets...
In order to hide the questions when included a few hacks are needed:
\cs_new_protected:Npn \hidequestions
{
\keys_set:nn {exsheets}
{
headings=blank ,
skip-below=0pt
}
\cs_set:Npn \__exsheets_save_and_print_question_body:n ##1
{ \exsheets_set_question_properties:n { question-body = {##1} } }
\cs_set_eq:NN \exsheets_h_or_vspace:N \use_none:n
}
A little bit more work is needed to print the questions (but no use of internal functions this time so the following is safe to use). The idea is to map over a comma separated list of IDs and print a question for each containing the question body of the original question for each ID. The questions must get 0 as value for points and bonus points if no points are given to avoid errors which means we need to check them first.
\tl_new:N \l_exsheets_this_question_points_tl
\tl_new:N \l_exsheets_this_question_bonus_tl
\cs_new_protected:Npn \printquestions #1
{%
\clist_map_inline:nn {#1}
{
% check if points are given or unknown,
% if yes feed `0' to the heading:
\prop_get:NnNF \g__exsheets_question_property_points_prop
{##1}
\l_exsheets_this_question_points_tl
{ \tl_set:Nn \l_exsheets_this_question_points_tl {0} }
% same for bonus points
\prop_get:cnNF {g__exsheets_question_property_bonus-points_prop}
{##1}
\l_exsheets_this_question_bonus_tl
{ \tl_set:Nn \l_exsheets_this_question_bonus_tl {0} }
% typeset the question:
\begin{question}{
\l_exsheets_this_question_points_tl +
\l_exsheets_this_question_bonus_tl
}
\exsheets_get_question_property:nn {question-body} {##1}
\end{question}
}
}
With the above defined functions and a file exercises.tex which contains
\begin{question}[ID=q1]
Q1
\end{question}
\begin{question}[ID=q2]
Q2
\end{question}
\begin{question}[ID=q3]
Q3
\end{question}
the document body
\begin{document}
\printquestions{q3,q1}
\hidequestions
\includequestions{exercises.tex}
\end{document}
gives

A warning: This approach has some drawbacks
- most notably:
\totalpoints and friends will count the points of the questions two times: once when included and the second time when printed.
\ForEachQuestion will loop over the questions twice for the same reason.
- others I didn't think of, yet, ...
The complete code:
\documentclass{article}
\usepackage{exsheets}
\usepackage{filecontents}
\begin{filecontents*}{exercises.tex}
\begin{question}[ID=q1]
Q1
\end{question}
\begin{question}[ID=q2]
Q2
\end{question}
\begin{question}[ID=q3]
Q3
\end{question}
\end{filecontents*}
\DeclareInstance{exsheets-heading}{blank}{default}{
inline = true ,
above = 0pt ,
below = 0pt ,
}
\ExplSyntaxOn
\cs_new_protected:Npn \hidequestions
{
\keys_set:nn {exsheets}
{
headings=blank ,
skip-below=0pt
}
\cs_set:Npn \__exsheets_save_and_print_question_body:n ##1
{ \exsheets_set_question_properties:n { question-body = {##1} } }
\cs_set_eq:NN \exsheets_h_or_vspace:N \use_none:n
}
\tl_new:N \l_exsheets_this_question_points_tl
\tl_new:N \l_exsheets_this_question_bonus_tl
\cs_new_protected:Npn \printquestions #1
{%
\clist_map_inline:nn {#1}
{
% check if points are given or unknown, if yes feed `0' to the heading:
\prop_get:NnNF \g__exsheets_question_property_points_prop
{##1}
\l_exsheets_this_question_points_tl
{ \tl_set:Nn \l_exsheets_this_question_points_tl {0} }
% same for bonus points
\prop_get:cnNF {g__exsheets_question_property_bonus-points_prop}
{##1}
\l_exsheets_this_question_bonus_tl
{ \tl_set:Nn \l_exsheets_this_question_bonus_tl {0} }
\begin{question}{
\l_exsheets_this_question_points_tl+\l_exsheets_this_question_bonus_tl
}
\exsheets_get_question_property:nn {question-body} {##1}
\end{question}
}
}
\ExplSyntaxOff
\begin{document}
\printquestions{q3,q1}
\hidequestions
\includequestions{exercises.tex}
\end{document}
\includequestions{<file>always includes questions in the order they're given in the file since at some point it simply boils down to\input{<file>}. – cgnieder Jul 14 '14 at 13:36