Using variable instead of files as input for xsltproc
I would like to use 2 variables rather than files as input for xsltproc, is this possiblle?
something like: Code:
xml="<?xml... />" |
I cannnot see any problem with it. So yes, you can.
But explain your concerns little more... What exactly your requirement is and where are you stuck? |
Try Process Substitution:
Code:
xml="<?xml... />" |
Quote:
problem: xsltproc takes 2 files as input what I currently have: Code:
echo "$xml" > xml.xml Quote:
Code:
result=$(xsltproc <(echo "$xslt") <(echo "$xml")) edit: using Code:
set +o posix P.S. what is the difference between: Code:
xsltproc xslt.xslt xml.xml # this works this was helpful Code:
echo "$xslt" | xsltproc - xml.xml |
Quote:
Code:
#!/bin/bash Code:
~/tmp$ ./xsltproc.sh Code:
xsltproc xslt.xslt xml.xml # this works |
Quote:
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. Linux 2.6.18-308.4.1.el5 x86_64 GNU/Linux Using libxml 20626, libxslt 10117 and libexslt 813 xsltproc was compiled against libxml 20626, libxslt 10117 and libexslt 813 libxslt 10117 was compiled against libxml 20626 libexslt 813 was compiled against libxml 20626 Code:
[user]$ xml='<?xml version="1.0"?> |
That's weird, Process Substitution is working for diff but not xsltproc. :scratch: Maybe try updating to a newer version of xsltproc? A possible workaround would be to use named fifo's:
Code:
mkfifo xpipe Another possibility is to use files, but put them in a ramfs/tmpfs. |
I can live with the xslt being on the disk, as that one shouldn't change too often in my use case, so I will just go with
Code:
echo "$xml" | xsltproc xpipe - |
All times are GMT -5. The time now is 05:32 PM. |