formatting xml with namespaces

Discussion in 'XML' started by printdude1968@gmail.com, Nov 19, 2006.

  1. Guest

    Hi Everyone...

    I'm a newbie to this stuff so bear with me.

    I have a well formed xml document (I use jdom to verify)

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <print-control>
    <destinations
    xmlns:destination0="http://mydomain.com/destinations/dest0"
    xmlns:destination1="http://mydomain.com/destinations/dest1"
    xmlns:destination2="http://mydomain.com/destinations/dest2"
    xmlns:destination3="http://mydomain.com/destinations/dest3"
    xmlns:destination4="http://mydomain.com/destinations/dest4"
    xmlns:destination5="http://mydomain.com/destinations/dest5"
    xmlns:destination6="http://mydomain.com/destinations/dest6"
    xmlns:destination7="http://mydomain.com/destinations/dest7"
    xmlns:destination8="http://mydomain.com/destinations/dest8"
    xmlns:destination9="http://mydomain.com/destinations/dest9">
    </destinations>
    <production
    xmlns:lp10="http://mydomain.comprinters/lp10"
    xmlns:lp20="http://mydomain.comprinters/lp20"
    xmlns:lp22="http://mydomain.comprinters/lp22"
    xmlns:lp80="http://mydomain.comprinters/lp80"
    xmlns:lp110="http://mydomain.comprinters/lp110"
    xmlns:lp320="http://mydomain.comprinters/lp320"
    xmlns:lp322="http://mydomain.comprinters/lp322"
    xmlns:lp650="http://mydomain.comprinters/lp650"
    xmlns:lp651="http://mydomain.comprinters/lp651"
    xmlns:lp652="http://mydomain.comprinters/lp652"
    xmlns:lp700="http://mydomain.comprinters/lp700"
    xmlns:lp701="http://mydomain.comprinters/lp701"
    xmlns:lp702="http://mydomain.comprinters/lp702"
    xmlns:lp703="http://mydomain.comprinters/lp703"
    xmlns:lp856="http://mydomain.comprinters/lp856"
    xmlns:lp900="http://mydomain.comprinters/lp900">
    <destination1>
    <lp10:configuration>
    <lp10:mapsBackToBCISClass>W</lp10:mapsBackToBCISClass>
    <lp10:queueType>psfOther</lp10:queueType>
    <lp10:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp10:formfontFilters>
    <lp10:formfontPath>/dev/fs/E/PrintApps/LBM</lp10:formfontPath>
    <lp10:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp10:jobName>
    <lp10:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp10:eek:ptionsInputTextFile>
    <lp10:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp10:dataInputTextFile>
    <lp10:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp10:chequeOutputPCLFile>
    <lp10:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp10:pclOutputPCLFile>
    <lp10:billsOutputTextFile>${dataInputTextFile}.bill</lp10:billsOutputTextFile>
    <lp10:changeDate>$(date "+%Y-%m-%d")</lp10:changeDate>
    <lp10:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp10:splitOn>
    <lp10:logicalQueue>PD${localQueueDestCode}PSF1</lp10:logicalQueue>
    <lp10:media>$( cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp10:media>
    <lp10:spliton>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp10:spliton>
    <lp10:countpage>${TOTAL_PAGES}</lp10:countpage>
    <lp10:startpage>1</lp10:startpage>
    <lp10:endpage>200</lp10:endpage>
    <lp10:numfile>1</lp10:numfile>
    <lp10:get_options>""</lp10:get_options>
    <lp10:defaultMedium>3hol</lp10:defaultMedium>
    </lp10:configuration>
    <lp700:configuration>
    <lp700:mapsBackToBCISClass>N/A</lp700:mapsBackToBCISClass>
    <lp700:queueType>PassThrough</lp700:queueType>

    <lp700:logicalQueue>PD${localQueueDestCode}PT1</lp700:logicalQueue>
    <lp700:fileName>$(cat ${optionsInputTextFile} | awk '{print $2}' |
    awk -F= '{print $2}' )</lp700:fileName>
    <lp700:plex>$(cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}' )</lp700:plex>
    <lp700:fileNamePart1>$( echo ${dev_file_name} | awk -F'_' '{print
    $1}')</lp700:fileNamePart1>
    <lp700:fileNamePart2>$( echo ${dev_file_name} | awk -F'_' '{print
    $2}')</lp700:fileNamePart2>
    <lp700:underwriterCode>$( echo ${fileNamePart2} | cut
    -c1-4)</lp700:underwriterCode>
    <lp700:repCode>$( echo ${fileNamePart2} | cut
    -c5-8)</lp700:repCode>
    <lp700:series>$( echo ${fileNamePart2} | cut -c9-9)</lp700:series>
    <lp700:group>$( echo ${fileNamePart2} | cut -c10-12)</lp700:group>
    <lp700:roomText>$(cat ${optionsInputTextFile} | awk '{print $6}' |
    awk -F= '{print $2}' )</lp700:roomText>
    <lp700:media>$(cat ${optionsInputTextFile} | awk '{print $4}' |
    awk -F= '{print $2}' )</lp700:media>
    <lp700:defaultMediaCode>"default-medium=${media}"</lp700:defaultMediaCode>
    </lp700:configuration>
    </destination1>
    <destination2>
    </destination2>
    <destination3>
    </destination3>
    <destination4>
    <lp110:configuration>
    <lp110:mapsBackToBCISClass>H</lp110:mapsBackToBCISClass>
    <lp110:queueType>psfOther</lp110:queueType>
    <lp110:logicalQueue>PD${localQueueDestCode}PSF3</lp110:logicalQueue>
    <lp110:defaultMedium>3hol</lp110:defaultMedium>
    <lp110:form>$( cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp110:form>
    <lp110:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp110:formfontFilters>
    <lp110:formfontPath>/dev/fs/E/PrintApps/LBM</lp110:formfontPath>
    <lp110:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp110:jobName>
    <lp110:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp110:eek:ptionsInputTextFile>
    <lp110:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp110:dataInputTextFile>
    <lp110:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp110:chequeOutputPCLFile>
    <lp110:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp110:pclOutputPCLFile>
    <lp110:billsOutputTextFile>${dataInputTextFile}.bill</lp110:billsOutputTextFile>
    <lp110:changeDate>$(date "+%Y-%m-%d")</lp110:changeDate>
    <lp110:lpsdirWin>"E:\\ROC\\OM\\server"</lp110:lpsdirWin>
    <lp110:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp110:splitOn>
    </lp110:configuration>
    </destination4>
    <destination5>
    </destination5>
    <destination6>
    <lp650:configuration>
    <lp650:mapsBackToBCISClass>CHEQQB</lp650:mapsBackToBCISClass>
    <lp650:queueType>PassThrough</lp650:queueType>
    <lp650:formfontMode>Dynamic</lp650:formfontMode>
    <lp650:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp650:formfontFilters>
    <lp650:formfontPath>/dev/fs/E/PrintApps/LBM</lp650:formfontPath>
    <lp650:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp650:jobName>
    <lp650:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp650:eek:ptionsInputTextFile>
    <lp650:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp650:dataInputTextFile>
    <lp650:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp650:chequeOutputPCLFile>
    <lp650:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp650:pclOutputPCLFile>
    <lp650:billsOutputTextFile>${dataInputTextFile}.bill</lp650:billsOutputTextFile>
    <lp650:changeDate>$(date "+%Y-%m-%d")</lp650:changeDate>
    <lp650:lpsdirWin>"E:\\ROC\\OM\\server"</lp650:lpsdirWin>
    <lp650:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp650:splitOn>
    <lp650:logicalQueue>PD${localQueueDestCode}PT2</lp650:logicalQueue>
    <lp650:media>$(cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp650:media>
    <lp650:form>$(cat ${optionsInputTextFile} | awk '{print $8}' | awk
    -F= '{print $2}')</lp650:form>
    <lp650:room>$(cat ${optionsInputTextFile} | awk '{print $9}' | awk
    -F= '{print $2}')</lp650:room>
    <lp650:programmerText>$(cat ${optionsInputTextFile} | awk '{print
    $3 " " $1 " " $10}')</lp650:programmerText>
    <lp650:programmerTextSpaced>$(echo $programmerText | sed "s/=/
    /g")</lp650:programmerTextSpaced>
    <lp650:programmerTextReplaced>$(echo $programmerTextSpaced| awk
    '{print $2 "." $4 "." $6}')</lp650:programmerTextReplaced>
    </lp650:configuration>
    <lp651:configuration>
    <lp651:mapsBackToBCISClass>CHEQQB2</lp651:mapsBackToBCISClass>
    <lp651:queueType>PassThrough</lp651:queueType>
    <lp651:formfontMode>Static</lp651:formfontMode>
    <lp651:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp651:formfontFilters>
    <lp651:formfontPath>/dev/fs/E/PrintApps/LBM</lp651:formfontPath>
    <lp651:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp651:jobName>
    <lp651:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp651:eek:ptionsInputTextFile>
    <lp651:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp651:dataInputTextFile>
    <lp651:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp651:chequeOutputPCLFile>
    <lp651:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp651:pclOutputPCLFile>
    <lp651:billsOutputTextFile>${dataInputTextFile}.bill</lp651:billsOutputTextFile>
    <lp651:changeDate>$(date "+%Y-%m-%d")</lp651:changeDate>
    <lp651:lpsdirWin>"E:\\ROC\\OM\\server"</lp651:lpsdirWin>
    <lp651:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp651:splitOn>
    <lp651:logicalQueue>PD${localQueueDestCode}PT2</lp651:logicalQueue>
    <lp651:componentCombo>$(cat ${optionsInputTextFile} | awk '{print
    $3 " " $1 " " $10}')</lp651:componentCombo>
    <lp651:comboNoDelimiter>$(echo ${componentCombo} | sed "s/=/
    /g")</lp651:comboNoDelimiter>
    <lp651:comboDotDelimiter>$(echo ${comboNoDelimiter}| awk '{print $2
    "." $4 "." $6}')</lp651:comboDotDelimiter>
    <lp651:room>$(cat ${optionsInputTextFile} | awk '{print $9}' | awk
    -F= '{print $2}')</lp651:room>
    <lp651:commentLine>"${dev_room}:${form}:Filename:${comboDotDelimiter}"</lp651:commentLine>
    </lp651:configuration>
    <lp652:configuration>
    <lp652:mapsBackToBCISClass>WQB</lp652:mapsBackToBCISClass>
    <lp652:queueType>psfOther</lp652:queueType>
    <lp652:logicalQueue>PD${localQueueDestCode}PSF1</lp652:logicalQueue>
    <lp652:defaultMedium>3hol</lp652:defaultMedium>
    <lp652:logicalQueue>PD${localQueueDestCode}PSF1</lp652:logicalQueue>
    <lp652:form>$( cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp652:form>
    <lp652:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp652:formfontFilters>
    <lp652:formfontPath>/dev/fs/E/PrintApps/LBM</lp652:formfontPath>
    <lp652:logOutputTextFile>${LPSDIR}/adm/log</lp652:logOutputTextFile>
    <lp652:topLevel>/dev/fs/E/</lp652:topLevel>
    <lp652:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp652:jobName>
    <lp652:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp652:eek:ptionsInputTextFile>
    <lp652:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp652:dataInputTextFile>
    <lp652:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp652:chequeOutputPCLFile>
    <lp652:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp652:pclOutputPCLFile>
    <lp652:billsOutputTextFile>${dataInputTextFile}.bill</lp652:billsOutputTextFile>
    <lp652:changeDate>$(date "+%Y-%m-%d")</lp652:changeDate>
    <lp652:lpsdirWin>"E:\\ROC\\OM\\server"</lp652:lpsdirWin>
    <lp652:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp652:splitOn>
    </lp652:configuration>
    <lp701:configuration>
    <lp701:mapsBackToBCISClass>N/A</lp701:mapsBackToBCISClass>
    <lp701:queueType>PassThrough</lp701:queueType>
    <lp701:logicalQueue>PD${localQueueDestCode}PT1</lp701:logicalQueue>
    <lp701:fileName>$(cat ${optionsInputTextFile} | awk '{print $2}' |
    awk -F= '{print $2}' )</lp701:fileName>
    <lp701:plex>$(cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}' )</lp701:plex>
    <lp701:fileNamePart1>$( echo ${dev_file_name} | awk -F'_' '{print
    $1}')</lp701:fileNamePart1>
    <lp701:fileNamePart2>$( echo ${dev_file_name} | awk -F'_' '{print
    $2}')</lp701:fileNamePart2>
    <lp701:underwriterCode>$( echo ${fileNamePart2} | cut
    -c1-4)</lp701:underwriterCode>
    <lp701:repCode>$( echo ${fileNamePart2} | cut
    -c5-8)</lp701:repCode>
    <lp701:series>$( echo ${fileNamePart2} | cut -c9-9)</lp701:series>
    <lp701:group>$( echo ${fileNamePart2} | cut -c10-12)</lp701:group>
    <lp701:roomText>$(cat ${optionsInputTextFile} | awk '{print $6}' |
    awk -F= '{print $2}' )</lp701:roomText>
    <lp701:media>$(cat ${optionsInputTextFile} | awk '{print $4}' |
    awk -F= '{print $2}' )</lp701:media>
    <lp701:defaultMediaCode>"default-medium=${media}"</lp701:defaultMediaCode>
    </lp701:configuration>
    </destination6>
    <lp702:configuration>
    </lp702:configuration>
    </destination7>
    <destination8>
    </destination8>
    <destination9>
    </destination9>
    </production>
    <development
    xmlns:lp10="http://mydomain.com/printers/lp10"
    xmlns:lp20="http://mydomain.com/printers/lp20"
    xmlns:lp22="http://mydomain.com/printers/lp22"
    xmlns:lp80="http://mydomain.com/printers/lp80"
    xmlns:lp110="http://mydomain.com/printers/lp110"
    xmlns:lp171="http://mydomain.com/printers/lp171"
    xmlns:lp173="http://mydomain.com/printers/lp173"
    xmlns:lp174="http://mydomain.com/printers/lp174"
    xmlns:lp175="http://mydomain.com/printers/lp175"
    xmlns:lp176="http://mydomain.com/printers/lp176"
    xmlns:lp320="http://mydomain.com/printers/lp320"
    xmlns:lp322="http://mydomain.com/printers/lp322"
    xmlns:lp650="http://mydomain.com/printers/lp650"
    xmlns:lp651="http://mydomain.com/printers/lp651"
    xmlns:lp652="http://mydomain.com/printers/lp652"
    xmlns:lp700="http://mydomain.com/printers/lp700"
    xmlns:lp701="http://mydomain.com/printers/lp701"
    xmlns:lp702="http://mydomain.com/printers/lp702"
    xmlns:lp703="http://mydomain.com/printers/lp703"
    xmlns:lp856="http://mydomain.com/printers/lp856"
    xmlns:lp900="http://mydomain.com/printers/lp900">
    <destination1>
    <lp173:configuration>
    <lp173:mapsBackToBCISClass>PDFCHE2</lp173:mapsBackToBCISClass>
    <lp173:queueType>N/A</lp173:queueType>
    <lp173:formfontMode>Static</lp173:formfontMode>
    <lp173:logicalQueue>pdfOnly</lp173:logicalQueue>
    <lp173:pdfChangeTime>$( date "+%H.%M.%S" )</lp173:pdfChangeTime>
    <lp173:pdfChangeDate>$( date "+%Y-%m-%d")</lp173:pdfChangeDate>
    <lp173:pdfProgrammerText>$( grep "programmer"
    ${optionsInputTextFile} | awk '{print $3}' | awk -F= '{print
    $2}')</lp173:pdfProgrammerText>
    <lp173:pdfJobname>$( grep "job" ${optionsInputTextFile} | awk
    '{print $1}' | awk -F= '{print $2}' )</lp173:pdfJobname>
    <lp173:pdfOutputFile>${LPDEST}/pdfOutputFile.${SEQ}</lp173:pdfOutputFile>
    <lp173:pdfRepname>$( grep "room" ${optionsInputTextFile} | awk
    '{print $9}' | awk -F= '{print $2}')</lp173:pdfRepname>
    <lp173:pdfForm>$( grep "room" ${optionsInputTextFile} | awk '{print
    $7}' | awk -F= '{print $2}')</lp173:pdfForm>
    <lp173:pdfRoom>( grep "room" ${optionsInputTextFile}| awk '{print
    $9}' | awk -F= '{print $2}')</lp173:pdfRoom>
    <lp173:pdfOutputFileName>${pdfProgrammerText}-${pdfJobname}-${pdfRepname}-${SEQ}</lp173:pdfOutputFileName>
    <lp173:pdfDocName>${pdfChangeDate}-${pdfForm}-${pdfOutputFileName}.${pdfChangeTime}.pdf
    </lp173:pdfDocName>
    </lp173:configuration>
    <lp700:configuration>
    <lp700:logicalQueue>PD${localQueueDestCode}PT1</lp700:logicalQueue>
    <lp700:fileName>$(cat ${optionsInputTextFile} | awk '{print $2}' |
    awk -F= '{print $2}' )</lp700:fileName>
    <lp700:plex>$(cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}' )</lp700:plex>
    <lp700:fileNamePart1>$( echo ${dev_file_name} | awk -F'_' '{print
    $1}')</lp700:fileNamePart1>
    <lp700:fileNamePart2>$( echo ${dev_file_name} | awk -F'_' '{print
    $2}')</lp700:fileNamePart2>
    <lp700:underwriterCode>$( echo ${fileNamePart2} | cut
    -c1-4)</lp700:underwriterCode>
    <lp700:repCode>$( echo ${fileNamePart2} | cut
    -c5-8)</lp700:repCode>
    <lp700:series>$( echo ${fileNamePart2} | cut -c9-9)</lp700:series>
    <lp700:group>$( echo ${fileNamePart2} | cut -c10-12)</lp700:group>
    <lp700:roomText>$(cat ${optionsInputTextFile} | awk '{print $6}' |
    awk -F= '{print $2}' )</lp700:roomText>
    <lp700:media>$(cat ${optionsInputTextFile} | awk '{print $4}' |
    awk -F= '{print $2}' )</lp700:media>
    <lp700:defaultMediaCode>"default-medium=${media}"</lp700:defaultMediaCode>
    </lp700:configuration>
    </destination2>
    <destination3>
    <lp20:configuration>
    <lp20:mapsBackToBCISClass>C</lp20:mapsBackToBCISClass>
    <lp20:queueType>psfOther</lp20:queueType>
    <lp20:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp20:formfontFilters>
    <lp20:formfontPath>/dev/fs/E/PrintApps/LBM</lp20:formfontPath>
    <lp20:logOutputTextFile>${LPSDIR}/adm/log</lp20:logOutputTextFile>
    <lp20:topLevel>/dev/fs/E/</lp20:topLevel>
    <lp20:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp20:jobName>
    <lp20:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp20:eek:ptionsInputTextFile>
    <lp20:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp20:dataInputTextFile>
    <lp20:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp20:chequeOutputPCLFile>
    <lp20:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp20:pclOutputPCLFile>
    <lp20:billsOutputTextFile>${dataInputTextFile}.bill</lp20:billsOutputTextFile>
    <lp20:changeDate>$(date "+%Y-%m-%d")</lp20:changeDate>
    <lp20:lpsdirWin>"E:\\ROC\\OM\\server"</lp20:lpsdirWin>
    <lp20:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp20:splitOn>
    <lp20:logicalQueue>doNotPrint</lp20:logicalQueue>
    </lp20:configuration>
    <lp900:configuration>
    <lp900:mapsBackToBCISClass>WO</lp900:mapsBackToBCISClass>
    <lp900:queueType>psfOther</lp900:queueType>
    <lp900:logicalQueue>PD${localQueueDestCode}PSF1</lp900:logicalQueue>
    <lp900:defaultMedium>3hol</lp900:defaultMedium>
    <lp900:logicalQueue>PD${localQueueDestCode}PSF1</lp900:logicalQueue>
    <lp900:form>$( cat ${optionsInputTextFile} | awk '{print $7}' | awk
    -F= '{print $2}')</lp900:form>
    <lp900:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp900:formfontFilters>
    <lp900:formfontPath>/dev/fs/E/PrintApps/LBM</lp900:formfontPath>
    <lp900:logOutputTextFile>${LPSDIR}/adm/log</lp900:logOutputTextFile>
    <lp900:topLevel>/dev/fs/E/</lp900:topLevel>
    <lp900:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    awk -F= '{print $2}')</lp900:jobName>
    <lp900:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp900:eek:ptionsInputTextFile>
    <lp900:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp900:dataInputTextFile>
    <lp900:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp900:chequeOutputPCLFile>
    <lp900:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp900:pclOutputPCLFile>
    <lp900:billsOutputTextFile>${dataInputTextFile}.bill</lp900:billsOutputTextFile>
    <lp900:changeDate>$(date "+%Y-%m-%d")</lp900:changeDate>
    <lp900:lpsdirWin>"E:\\ROC\\OM\\server"</lp900:lpsdirWin>
    <lp900:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    -c2-4)</lp900:splitOn>
    </lp900:configuration>
    </destination3>
    </development>
    </print-control>


    What I need is an xsl or something which will let me go through the
    document and create a table
    Pseudo code
    for each destination d in production
    for each printer (ie. lp10) in d
    format a line for each attribute
    done
    done
    for each destination d in developement
    for each printer (ie. lp10) in d
    format a line for each attribute
    done
    done


    I've played around with xsl and xslt and seem to run into issues when I
    find that I need to process the
    namespaces....

    There must be an easy way to do it
    Here's what I'd like my output to look like

    Production
    lp110
    BackToBCISClass=>H
    queueType=>psfOther
    logicalQueue=PD${localQueueDestCode}PSF3
    defaultMedium=>3hol
    form=>$( cat ${optionsInputTextFile} | awk '{print $7}' | awk -F=
    '{print $2}')
    formfontFilters=>/dev/fs/E/PrintApps/LBM/filters/
    formfontPath=>/dev/fs/E/PrintApps/LBM
    jobName=>$(cat ${optionsInputTextFile} | awk '{print $1}' | awk
    -F= '{print $2}')
    optionsInputTextFile=>${LPSDIR}/${DEST}/o.${SEQ}
    dataInputTextFile=>${LPSDIR}/${DEST}/p.${SEQ}
    chequeOutputPCLFile=>${LPSDIR}/${DEST}/cheque.${SEQ}
    pclOutputPCLFile=${LPSDIR}/${DEST}/file.${SEQ}
    billsOutputTextFile=>${dataInputTextFile}.bill
    changeDate=>$(date "+%Y-%m-%d")
    lpsdirWin=>"E:\\ROC\\OM\\server"
    splitOn=>$( head -n 1 ${dataInputTextFile} | cut -c2-4)

    Is this possible using xsl or xslt and if so, how do I reconcile the
    namespaces?
     
    , Nov 19, 2006
    #1
    1. Advertising

  2. In message <>,
    "" <> writes
    >What I need is an xsl or something which will let me go through the
    >document and create a table
    >Pseudo code
    > for each destination d in production
    > for each printer (ie. lp10) in d
    > format a line for each attribute
    > done
    > done
    > for each destination d in developement
    > for each printer (ie. lp10) in d
    > format a line for each attribute
    > done
    > done
    >
    >
    >I've played around with xsl and xslt and seem to run into issues when I
    >find that I need to process the
    >namespaces....


    The local-name() function allows you to access the name of an element
    irrespective of its namespace URI, and name() gives you the whole name,
    namespace prefix included. So you could do:

    <xsl:template match="*[local-name()='configuration']">
    <div>
    <div>
    <xsl:value-of select="substring-before(name(), ':')"/>
    </div>
    <div>
    <xsl:apply-templates mode="description"/>
    </div>
    </div>
    </xsl:template>

    <xsl:template match="*" mode="description">
    <div>
    <xsl:value-of select="concat(local-name(), '=>', text())"/>
    </div>
    </xsl:template>

    where I have used <div> elements to indicate whatever structure you
    might like to put around your output.

    Richard Light

    >There must be an easy way to do it
    >Here's what I'd like my output to look like
    >
    >Production
    > lp110
    > BackToBCISClass=>H
    > queueType=>psfOther
    > logicalQueue=PD${localQueueDestCode}PSF3
    > defaultMedium=>3hol
    > form=>$( cat ${optionsInputTextFile} | awk '{print $7}' |
    >awk -F=
    >'{print $2}')
    > formfontFilters=>/dev/fs/E/PrintApps/LBM/filters/
    > formfontPath=>/dev/fs/E/PrintApps/LBM
    > jobName=>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    >awk
    >-F= '{print $2}')
    > optionsInputTextFile=>${LPSDIR}/${DEST}/o.${SEQ}
    > dataInputTextFile=>${LPSDIR}/${DEST}/p.${SEQ}
    > chequeOutputPCLFile=>${LPSDIR}/${DEST}/cheque.${SEQ}
    > pclOutputPCLFile=${LPSDIR}/${DEST}/file.${SEQ}
    > billsOutputTextFile=>${dataInputTextFile}.bill
    > changeDate=>$(date "+%Y-%m-%d")
    > lpsdirWin=>"E:\\ROC\\OM\\server"
    > splitOn=>$( head -n 1 ${dataInputTextFile} | cut -c2-4)
    >
    >Is this possible using xsl or xslt and if so, how do I reconcile the
    >namespaces?
    >


    --
    Richard Light
    SGML/XML and Museum Information Consultancy
     
    Richard Light, Nov 20, 2006
    #2
    1. Advertising

  3. escribió:
    > Hi Everyone...
    >
    > I'm a newbie to this stuff so bear with me.
    >
    > I have a well formed xml document (I use jdom to verify)


    Sorry, no. There is at least one unmatched tag: </destination7>.

    >
    > <?xml version="1.0" encoding="ISO-8859-1"?>
    > <print-control>
    > <destinations
    > xmlns:destination0="http://mydomain.com/destinations/dest0"
    > xmlns:destination1="http://mydomain.com/destinations/dest1"
    > ...
    > </destinations>
    > <production
    > xmlns:lp10="http://mydomain.comprinters/lp10"
    > xmlns:lp20="http://mydomain.comprinters/lp20"
    > ...
    > <destination1>
    > <lp10:configuration>
    > <lp10:mapsBackToBCISClass>W</lp10:mapsBackToBCISClass>
    > <lp10:queueType>psfOther</lp10:queueType>
    > <lp10:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp10:formfontFilters>
    > <lp10:formfontPath>/dev/fs/E/PrintApps/LBM</lp10:formfontPath>
    > <lp10:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    > awk -F= '{print $2}')</lp10:jobName>
    > <lp10:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp10:eek:ptionsInputTextFile>
    > <lp10:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp10:dataInputTextFile>
    > <lp10:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp10:chequeOutputPCLFile>
    > <lp10:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp10:pclOutputPCLFile>
    > <lp10:billsOutputTextFile>${dataInputTextFile}.bill</lp10:billsOutputTextFile>
    > <lp10:changeDate>$(date "+%Y-%m-%d")</lp10:changeDate>
    > <lp10:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    > -c2-4)</lp10:splitOn>
    > ...
    > </lp900:configuration>
    > </destination3>
    > </development>
    > </print-control>
    >
    >
    > What I need is an xsl or something which will let me go through the
    > document and create a table ...
    >
    > I've played around with xsl and xslt and seem to run into issues when I
    > find that I need to process the
    > namespaces....
    >
    > There must be an easy way to do it
    > ...
    > Is this possible using xsl or xslt and if so, how do I reconcile the
    > namespaces?


    Any programming language with decent XML libraries can be used instead of XSLT.

    Your data contains some references to AWK. Perhaps you could try xmlgawk:

    http://sourceforge.net/projects/xmlgawk

    Regards.
    --
    Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
     
    Manuel Collado, Nov 20, 2006
    #3
  4. Guest

    Hi

    I was able to solve it... basically I took out all the namespaces.
    Once I did that, adding the xslt to display it was pretty easy.

    Richard Light wrote:
    > In message <>,
    > "" <> writes
    > >What I need is an xsl or something which will let me go through the
    > >document and create a table
    > >Pseudo code
    > > for each destination d in production
    > > for each printer (ie. lp10) in d
    > > format a line for each attribute
    > > done
    > > done
    > > for each destination d in developement
    > > for each printer (ie. lp10) in d
    > > format a line for each attribute
    > > done
    > > done
    > >
    > >
    > >I've played around with xsl and xslt and seem to run into issues when I
    > >find that I need to process the
    > >namespaces....

    >
    > The local-name() function allows you to access the name of an element
    > irrespective of its namespace URI, and name() gives you the whole name,
    > namespace prefix included. So you could do:
    >
    > <xsl:template match="*[local-name()='configuration']">
    > <div>
    > <div>
    > <xsl:value-of select="substring-before(name(), ':')"/>
    > </div>
    > <div>
    > <xsl:apply-templates mode="description"/>
    > </div>
    > </div>
    > </xsl:template>
    >
    > <xsl:template match="*" mode="description">
    > <div>
    > <xsl:value-of select="concat(local-name(), '=>', text())"/>
    > </div>
    > </xsl:template>
    >
    > where I have used <div> elements to indicate whatever structure you
    > might like to put around your output.
    >
    > Richard Light
    >
    > >There must be an easy way to do it
    > >Here's what I'd like my output to look like
    > >
    > >Production
    > > lp110
    > > BackToBCISClass=>H
    > > queueType=>psfOther
    > > logicalQueue=PD${localQueueDestCode}PSF3
    > > defaultMedium=>3hol
    > > form=>$( cat ${optionsInputTextFile} | awk '{print $7}' |
    > >awk -F=
    > >'{print $2}')
    > > formfontFilters=>/dev/fs/E/PrintApps/LBM/filters/
    > > formfontPath=>/dev/fs/E/PrintApps/LBM
    > > jobName=>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    > >awk
    > >-F= '{print $2}')
    > > optionsInputTextFile=>${LPSDIR}/${DEST}/o.${SEQ}
    > > dataInputTextFile=>${LPSDIR}/${DEST}/p.${SEQ}
    > > chequeOutputPCLFile=>${LPSDIR}/${DEST}/cheque.${SEQ}
    > > pclOutputPCLFile=${LPSDIR}/${DEST}/file.${SEQ}
    > > billsOutputTextFile=>${dataInputTextFile}.bill
    > > changeDate=>$(date "+%Y-%m-%d")
    > > lpsdirWin=>"E:\\ROC\\OM\\server"
    > > splitOn=>$( head -n 1 ${dataInputTextFile} | cut -c2-4)
    > >
    > >Is this possible using xsl or xslt and if so, how do I reconcile the
    > >namespaces?
    > >

    >
    > --
    > Richard Light
    > SGML/XML and Museum Information Consultancy
    >
     
    , Nov 20, 2006
    #4
  5. Guest

    I didn't include the entire XML document as I was just trying to show a
    snippet of the document (it's over 1500 lines long).

    Manuel Collado wrote:
    > escribió:
    > > Hi Everyone...
    > >
    > > I'm a newbie to this stuff so bear with me.
    > >
    > > I have a well formed xml document (I use jdom to verify)

    >
    > Sorry, no. There is at least one unmatched tag: </destination7>.
    >
    > >
    > > <?xml version="1.0" encoding="ISO-8859-1"?>
    > > <print-control>
    > > <destinations
    > > xmlns:destination0="http://mydomain.com/destinations/dest0"
    > > xmlns:destination1="http://mydomain.com/destinations/dest1"
    > > ...
    > > </destinations>
    > > <production
    > > xmlns:lp10="http://mydomain.comprinters/lp10"
    > > xmlns:lp20="http://mydomain.comprinters/lp20"
    > > ...
    > > <destination1>
    > > <lp10:configuration>
    > > <lp10:mapsBackToBCISClass>W</lp10:mapsBackToBCISClass>
    > > <lp10:queueType>psfOther</lp10:queueType>
    > > <lp10:formfontFilters>/dev/fs/E/PrintApps/LBM/filters/</lp10:formfontFilters>
    > > <lp10:formfontPath>/dev/fs/E/PrintApps/LBM</lp10:formfontPath>
    > > <lp10:jobName>$(cat ${optionsInputTextFile} | awk '{print $1}' |
    > > awk -F= '{print $2}')</lp10:jobName>
    > > <lp10:eek:ptionsInputTextFile>${LPSDIR}/${DEST}/o.${SEQ}</lp10:eek:ptionsInputTextFile>
    > > <lp10:dataInputTextFile>${LPSDIR}/${DEST}/p.${SEQ}</lp10:dataInputTextFile>
    > > <lp10:chequeOutputPCLFile>${LPSDIR}/${DEST}/cheque.${SEQ}</lp10:chequeOutputPCLFile>
    > > <lp10:pclOutputPCLFile>${LPSDIR}/${DEST}/file.${SEQ}</lp10:pclOutputPCLFile>
    > > <lp10:billsOutputTextFile>${dataInputTextFile}.bill</lp10:billsOutputTextFile>
    > > <lp10:changeDate>$(date "+%Y-%m-%d")</lp10:changeDate>
    > > <lp10:splitOn>$( head -n 1 ${dataInputTextFile} | cut
    > > -c2-4)</lp10:splitOn>
    > > ...
    > > </lp900:configuration>
    > > </destination3>
    > > </development>
    > > </print-control>
    > >
    > >
    > > What I need is an xsl or something which will let me go through the
    > > document and create a table ...
    > >
    > > I've played around with xsl and xslt and seem to run into issues when I
    > > find that I need to process the
    > > namespaces....
    > >
    > > There must be an easy way to do it
    > > ...
    > > Is this possible using xsl or xslt and if so, how do I reconcile the
    > > namespaces?

    >
    > Any programming language with decent XML libraries can be used instead of XSLT.
    >
    > Your data contains some references to AWK. Perhaps you could try xmlgawk:
    >
    > http://sourceforge.net/projects/xmlgawk
    >
    > Regards.
    > --
    > Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
     
    , Nov 20, 2006
    #5
  6. A smaller (and complete) sample would have been more useful; easier to
    read and to discuss. So would a more specific description of what
    "issues" you run into when you "need to process the namespaces".

    Handling namespaces in XSLT should be easy enough -- to reference a
    namespaced element or attribute, you need to define a prefix in the XSLT
    that refers to the same namespace, and use that in your paths and
    patterns. It's common, but not necessary, to use the same prefix in the
    stylesheet that you use in your source documents. One complication: In
    their 1.0 versions, XPath and XSLT can't set a default namespace; you
    must use a prefix in the stylesheet even if your source document used
    the default shorthand.

    As others have noted, if you want to deliberately ignore the namespaces
    -- which is a VERY BAD idea, since you wouldn't have used namespaces in
    the first place if they weren't semantically significant! -- you can
    kluge that by using wildcard patterns combined with predicates that
    explicitly test only the localname, or (if you want to completely bollox
    the intent and make other developers curse your name) the prefix and/or
    qname.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Nov 21, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y3VydGlzemFyZ2Vy?=

    can't find Beta 2 XML namespaces

    =?Utf-8?B?Y3VydGlzemFyZ2Vy?=, Aug 5, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    368
    =?Utf-8?B?Y3VydGlzemFyZ2Vy?=
    Aug 5, 2005
  2. Mark Smits

    Newbie: XML 2 XML and namespaces

    Mark Smits, Sep 17, 2003, in forum: XML
    Replies:
    2
    Views:
    653
    Mark Smits
    Sep 21, 2003
  3. Greg Wogan-Browne
    Replies:
    1
    Views:
    810
    Uche Ogbuji
    Jan 28, 2005
  4. Replies:
    1
    Views:
    403
    Joseph Kesselman
    Jun 7, 2007
  5. cp
    Replies:
    2
    Views:
    403
Loading...

Share This Page