I am trying to convert an XML Configuration files to text files.I had few concerns. My schema allows creation of different formats for elements. For example if i have 2 possibilities to populate an xml file:
<Dir Path="C:\MyFolder\">
<FileName> Test.txt</Name>
</Dir>
or
<Dir Path="C:\MyFolder\" >
<WildCard> *.txt</WildCard>
</Dir>
i have to write a transformation(xslt) to transform to text which retrieves the Path attribute of the element Dir and outputs something like this:
Dir: "C:\MyFolder\"
FileName: Test.txt
and if it sees the wildcard the text file should output as follows:
Dir:"C:\MyFolder\"
WildCard: *.txt
I know i can do a <xsl:for-each> to parse through each directory element, and use <xsl:value of select="FileName"> for retrieving element contents. i was wondering how xslt maps the choice i may have in different xml files and how to retrieve attribute Path from the <Dir> element and output in the text as described? I tried googling for this...and nobody gave a clearcut way to retrieve node attributes. Can you provide me insights into this?
thanks
<Dir Path="C:\MyFolder\">
<FileName> Test.txt</Name>
</Dir>
or
<Dir Path="C:\MyFolder\" >
<WildCard> *.txt</WildCard>
</Dir>
i have to write a transformation(xslt) to transform to text which retrieves the Path attribute of the element Dir and outputs something like this:
Dir: "C:\MyFolder\"
FileName: Test.txt
and if it sees the wildcard the text file should output as follows:
Dir:"C:\MyFolder\"
WildCard: *.txt
I know i can do a <xsl:for-each> to parse through each directory element, and use <xsl:value of select="FileName"> for retrieving element contents. i was wondering how xslt maps the choice i may have in different xml files and how to retrieve attribute Path from the <Dir> element and output in the text as described? I tried googling for this...and nobody gave a clearcut way to retrieve node attributes. Can you provide me insights into this?
thanks