Oracle Message LPX-00323 - illegal apply-imports because of no current template: ~s

ERRORillegal apply-imports because of no current template: ~s
CAUSEapply-imports was used even when there was no current template possibly with in for-each.
ACTIONMake sure that apply-imports are invoked only if there is a current template and it is not in a xsl: for-each.