Accept data from file or stdin in script

I have a script that looks like this:

sed -f myfile.sed $1 > $1.out

called myscript and would like to change it so the parameter isn't necessary:

ls *.idx | myscript | xargs some_command

What do I need to add so it can run either way?

TIA

---------- Post updated at 09:41 AM ---------- Previous update was at 09:33 AM ----------

Never mind, asked for help too soon. After

if [ $# -eq 0 ]
  then

I added the same sed command removing everything on the line starting with the first $1.

Thanks for the update.