|
| Last position |
 |
Fri, 28 Mar 2008 16:51:22 -070 |
I have an xsl sheet that works fine except if it is the last (or first)
node, I want to add another set of tags.
For example with the following XML:
**********************************************************
<?xml version="1.0" encoding="utf-8"?>
<REPORT VERSION="1.10" FILENUM="" DESCRIPTION="Form
Utility XML: 3/18/2008
12:27:13 PM" MAJORFORM="1004">
<FORMS>
<FORM NUM="1" FORMCODE="1004" SECCODE="1"
DESC="" MAJOR="True" >
<FIELDS>
<OTHERFILENUMBER>692</OTHERFILENUMBER>
<FNMA_FILENUMBER>693</FNMA_FILENUMBER>
<SUBPROPADDRESS>3</SUBPROPADDRESS>
</FIELDS>
</FORM>
</FORMS>
</REPORT>
****************************************
And the following xslt sheet.
**************************************************
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/*">
<xsl:copy>
<xsl:apply-templates select="FORMS/FORM"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FIELDS/*">
<form>
<sectionNumber>
<xsl:value-of select="../../@SECCODE"/>
</sectionNumber>
<primary>True</primary>
<formName>
<xsl:value-of select="../../@FORMCODE"/>
</formName>
<tagName>
<xsl:value-of select="name()"/>
</tagName>
<flags>0</flags>
<format>0</format>
<value>
<xsl:value-of select="."/>
</value>
</form>
<xsl:if test="position()=last()">
<form>
<sectionNumber>
<xsl:value-of select="../../@SECCODE"/>
</sectionNumber>
<primary>True</primary>
<formName>
<xsl:value-of select="../../@FORMCODE"/>
</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>
<value>Some Value</value>
</form>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
******************************************
The result of this is:
*********************************************
<?xml version="1.0" encoding="utf-8"?>
<REPORT>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>OTHERFILENUMBER</tagName>
<flags>0</flags>
<format>0</format>
<value>692</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FNMA_FILENUMBER</tagName>
<flags>0</flags>
<format>0</format>
<value>693</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>SUBPROPADDRESS</tagName>
<flags>0</flags>
<format>0</format>
<value>3</value>
</form>
</REPORT>
*****************************************
What I need is to get one more set of form tags that has the attributes
(which can be different from xml to xml) from the <FORM> tag of the xml
file.
So the last form would look something like:
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>
<value>NUM="1" FORMCODE="1004"
SECCODE="1" DESC="" MAJOR="True"</value>
</form>
Or it could be the whole tag:
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>
<value><FORM NUM="1" FORMCODE="1004"
SECCODE="1" DESC="" MAJOR="True" >
</value>
</form>
I just need to get the information so I can put it in my database.
I thought I could do the <xsl:if test="position()=last()"> from
above, but
it doesn't seem to work.
Thanks,
Tom
|
| Post Reply
|
| Re: Last position |
 |
Sat, 29 Mar 2008 13:44:19 +010 |
tshad wrote:
> So the last form would look something like:
>
> <form>
> <sectionNumber>1</sectionNumber>
> <primary>True</primary>
> <formName>1004</formName>
> <tagName>FormFormats</tagName>
> <flags>0</flags>
> <format>0</format>
> <value>NUM="1" FORMCODE="1004"
SECCODE="1" DESC="" MAJOR="True"</value>
> </form>
This adds an additional form element
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="REPORT">
<xsl:copy>
<xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FIELDS/*">
<form>
<sectionNumber><xsl:value-of
select="../../@SECCODE"/></sectionNumber>
<primary>True</primary>
<formName><xsl:value-of
select="../../@FORMCODE"/></formName>
<tagName><xsl:value-of
select="name()"/></tagName>
<value><xsl:value-of select="."/></value>
</form>
<xsl:if test="position() = last()">
<form>
<sectionNumber><xsl:value-of
select="../../@SECCODE"/></sectionNumber>
<primary>True</primary>
<formName><xsl:value-of
select="../../@FORMCODE"/></formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>
<value>
<xsl:apply-templates select="../../@*"/>
</value>
</form>
</xsl:if>
</xsl:template>
<xsl:template match="FORM/@*">
<xsl:value-of select="concat(name(), '=', .)"/>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen --- MVP XML
|
| Post Reply
|
| Re: Last position |
 |
Mon, 31 Mar 2008 10:41:53 -070 |
I am going to respond to this twice, only because I don't want to confuse
the issue and I want to change example a little to explain my 2nd question
on this.
"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:u0qKeqZkIHA.5820@TK2MSFTNGP04.phx.gbl...
> tshad wrote:
>
>> So the last form would look something like:
>>
>> <form>
>> <sectionNumber>1</sectionNumber>
>> <primary>True</primary>
>> <formName>1004</formName>
>> <tagName>FormFormats</tagName>
>> <flags>0</flags>
>> <format>0</format>
>> <value>NUM="1" FORMCODE="1004"
SECCODE="1" DESC=""
>> MAJOR="True"</value>
>> </form>
>
> This adds an additional form element
Right.
That is what I am trying to do. Get another form element where the
important field would only be the <value> which gives me the all the
attributes in the
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:output method="xml" indent="yes"/>
>
> <xsl:template match="REPORT">
> <xsl:copy>
> <xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="FIELDS/*">
> <form>
> <sectionNumber><xsl:value-of
> select="../../@SECCODE"/></sectionNumber>
> <primary>True</primary>
> <formName><xsl:value-of
select="../../@FORMCODE"/></formName>
> <tagName><xsl:value-of
select="name()"/></tagName>
> <value><xsl:value-of
select="."/></value>
> </form>
> <xsl:if test="position() = last()">
> <form>
> <sectionNumber><xsl:value-of
> select="../../@SECCODE"/></sectionNumber>
> <primary>True</primary>
> <formName><xsl:value-of
select="../../@FORMCODE"/></formName>
> <tagName>FormFormats</tagName>
> <flags>0</flags>
> <format>0</format>
> <value>
> <xsl:apply-templates select="../../@*"/>
> </value>
> </form>
> </xsl:if>
> </xsl:template>
>
> <xsl:template match="FORM/@*">
> <xsl:value-of select="concat(name(), '=', .)"/>
> <xsl:if test="position() != last()">
> <xsl:text> </xsl:text>
> </xsl:if>
> </xsl:template>
>
> </xsl:stylesheet>
>
Worked perfectly.
I am confused as to why it did, however.
In my file, I had:
<xsl:apply-templates select="FORMS/FORM"/>
which doesn't work - doesn't seem to handle the "xsl:if test" so I
don't get
the extra form element. But it works perfectly for the other 3. It
displayes the 3 form elements just not the extra one inside the test.
You changed it to:
<xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
and it handles it fine. I thought that "FORMS/FORM" would handle all
the
child elements. Why do I need the /FIELDS/* ?
Also,
Yours indents perfectly:
mine just appends each tag one after another. Yet I also have the
"indent=yes" in my xsl:output.
<?xml version="1.0" encoding="utf-8"?>
<REPORT>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>OTHERFILENUMBER&l
t;/tagName><flags>0</flags><format>0</format><valu
e>692</value></form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>FNMA_FILENUMBER&l
t;/tagName><flags>0</flags><format>0</format><valu
e>693</value></form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>SUBPROPADDRESS<
;/tagName><flags>0</flags><format>0</format><value
>3</value></form>
</REPORT>
why is that?
This last question is similar to the one I am going to ask with a more
expanded example:
In this sample, we have 2 templates and 2 apply-templates.
When we say:
<xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
How does it know to use the 1st template?
And how does:
<xsl:apply-templates select="../../@*"/>
know to use the last template since there are no template names or ids?
Thanks,
Tom
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
|
| Post Reply
|
| Re: Last position |
 |
Mon, 31 Mar 2008 11:05:31 -070 |
This is the 2nd question using the same answer you gave here.
But what I am doing is adding one more template (which is what I took out to
simplify the question originally) which doesn't work with this answer. I
assume this is because of the change in the apply-template (FORMS/FORM) to
(FORMS/FORM/FIELDS/*).
"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:u0qKeqZkIHA.5820@TK2MSFTNGP04.phx.gbl...
> tshad wrote:
>
>> So the last form would look something like:
>>
>> <form>
>> <sectionNumber>1</sectionNumber>
>> <primary>True</primary>
>> <formName>1004</formName>
>> <tagName>FormFormats</tagName>
>> <flags>0</flags>
>> <format>0</format>
>> <value>NUM="1" FORMCODE="1004"
SECCODE="1" DESC=""
>> MAJOR="True"</value>
>> </form>
>
> This adds an additional form element
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:output method="xml" indent="yes"/>
>
> <xsl:template match="REPORT">
> <xsl:copy>
> <xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="FIELDS/*">
> <form>
> <sectionNumber><xsl:value-of
> select="../../@SECCODE"/></sectionNumber>
> <primary>True</primary>
> <formName><xsl:value-of
select="../../@FORMCODE"/></formName>
> <tagName><xsl:value-of
select="name()"/></tagName>
> <value><xsl:value-of
select="."/></value>
> </form>
> <xsl:if test="position() = last()">
> <form>
> <sectionNumber><xsl:value-of
> select="../../@SECCODE"/></sectionNumber>
> <primary>True</primary>
> <formName><xsl:value-of
select="../../@FORMCODE"/></formName>
> <tagName>FormFormats</tagName>
> <flags>0</flags>
> <format>0</format>
> <value>
> <xsl:apply-templates select="../../@*"/>
> </value>
> </form>
> </xsl:if>
> </xsl:template>
>
> <xsl:template match="FORM/@*">
> <xsl:value-of select="concat(name(), '=', .)"/>
> <xsl:if test="position() != last()">
> <xsl:text> </xsl:text>
> </xsl:if>
> </xsl:template>
>
> </xsl:stylesheet>
With a change where I add one more template:
*****************************************
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="REPORT">
<xsl:copy>
<xsl:apply-templates select="FORMS/FORM"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FIELDS/*">
<form>
<sectionNumber>
<xsl:value-of select="../../@SECCODE"/>
</sectionNumber>
<primary>True</primary>
<formName>
<xsl:value-of select="../../@FORMCODE"/>
</formName>
<tagName>
<xsl:value-of select="name()"/>
</tagName>
<flags>0</flags>
<format>0</format>
<value>
<xsl:value-of select="."/>
</value>
</form>
<xsl:if test="position()=last()">
<form>
<sectionNumber>
<xsl:value-of select="../../@SECCODE"/>
</sectionNumber>
<primary>True</primary>
<formName>
<xsl:value-of select="../../@FORMCODE"/>
</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>
<xsl:apply-templates select="../../@*"/>
</form>
</xsl:if>
</xsl:template>
<xsl:template match="attachments/attachment">
<attachment>
<key>
<xsl:value-of select="@key"/>
</key>
<type>
<xsl:value-of select="@type"/>
</type>
<label>
<xsl:value-of select="@label"/>
</label>
<imageFormat>
<xsl:value-of select="image/binary/@format"/>
</imageFormat>
<imageText>
<xsl:value-of select="image/binary/text()"/>
</imageText>
<thumbnailFormat>
<xsl:value-of select="thumbnail/binary/@format"/>
</thumbnailFormat>
<thumbnailImage>
<xsl:value-of select="thumbnail/binary/text()"/>
</thumbnailImage>
<sourceFormat>
<xsl:value-of select="source/@format"/>
</sourceFormat>
<sourceKey>
<xsl:value-of select="source/@key"/>
</sourceKey>
<sourceText>
<xsl:value-of select="source/binary/text()"/>
</sourceText>
</attachment>
</xsl:template>
<xsl:template match="FORM/@*">
<xsl:value-of select="concat(name(), '=', .)"/>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
********************************************
The xml file is:
***********************************************
<?xml version="1.0" encoding="utf-8"?>
<REPORT VERSION="1.10" FILENUM="" DESCRIPTION="Form
Utility XML: 3/18/2008
12:27:13 PM" MAJORFORM="1004">
<ORDER></ORDER>
<TRACKING></TRACKING>
<FORMS>
<FORM NUM="1" FORMCODE="1004" SECCODE="1"
DESC="" MAJOR="True" >
<FIELDS>
<OTHERFILENUMBER>692</OTHERFILENUMBER>
<FNMA_FILENUMBER>693</FNMA_FILENUMBER>
<SUBPROPADDRESS>3</SUBPROPADDRESS>
</FIELDS>
<FORMPHOTOS></FORMPHOTOS>
<attachments>
<attachment key="db8d208f-b049-4caa-bac0-eeb4cf9007d6"
type="photo"
label="Comparable Sale #1">
<image>
<binary xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="bin.base64"
format="jpeg">/9j/4AAQSkZJRgA</binary>
</image>
<thumbnail>
<binary xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="bin.base64"
format="jpeg">/9j/4AAQSkZ</binary>
</thumbnail>
</attachment>
<attachment key="560ff252-882d-4d3e-9e0c-aa1cb7c38952"
type="photo"
label="Comparable Sale #2">
<image>
<binary xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="bin.base64"
format="jpeg">/9j/4AAQSkZJR</binary>
</image>
<thumbnail>
<binary xmlns:dt="urn:schemas-microsoft-com:datatypes"
dt:dt="bin.base64"
format="jpeg">/9j/4AAQSkZJR</binary>
</thumbnail>
</attachment>
</attachments>
</FORM>
</FORMS>
</REPORT>
***************************************************************
And my result is:
*****************************************************************
<?xml version="1.0" encoding="utf-8"?>
<REPORT>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>OTHERFILENUMBER&l
t;/tagName><flags>0</flags><format>0</format><valu
e>692</value></form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>FNMA_FILENUMBER&l
t;/tagName><flags>0</flags><format>0</format><valu
e>693</value></form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>SUBPROPADDRESS<
;/tagName><flags>0</flags><format>0</format><value
>3</value></form>
<attachment><key>db8d208f-b049-4caa-bac0-eeb4cf9007d6</key><
;type>photo</type><label>Comparable
Sale
#1</label><imageFormat>jpeg</imageFormat><imageText>/9j/
4AAQSkZJRgA</imageText><thumbnailFormat>jpeg</thumbnailFormat>
<thumbnailImage>/9j/4AAQSkZ</thumbnailImage><sourceFormat><
/sourceFormat><sourceKey></sourceKey><sourceText></sourc
eText></attachment>
<attachment><key>560ff252-882d-4d3e-9e0c-aa1cb7c38952</key><
;type>photo</type><label>Comparable
Sale
#2</label><imageFormat>jpeg</imageFormat><imageText>/9j/
4AAQSkZJR</imageText><thumbnailFormat>jpeg</thumbnailFormat>&l
t;thumbnailImage>/9j/4AAQSkZJR</thumbnailImage><sourceFormat><
/sourceFormat><sourceKey></sourceKey><sourceText></sourc
eText></attachment>
</REPORT>
*****************************************************************
Of course, I still have the same problem from my old example where there is
no indenting.
So I changed the apply-templates to:
********************************************************
<xsl:template match="REPORT">
<xsl:copy>
<xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
<xsl:apply-templates select="FORMS/FORM"/>
</xsl:copy>
</xsl:template>
********************************************************
And it almost worked, but it gave me an extra set of form elements: mine
(with no indents) and yours(indented and the extra form element - but the
last </form> didn't seem to indent).
******************************************************************
<?xml version="1.0" encoding="utf-8"?>
<REPORT>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>OTHERFILENUMBER</tagName>
<flags>0</flags>
<format>0</format>
<value>692</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FNMA_FILENUMBER</tagName>
<flags>0</flags>
<format>0</format>
<value>693</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>SUBPROPADDRESS</tagName>
<flags>0</flags>
<format>0</format>
<value>3</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>NUM=1 FORMCODE=1004 SECCODE=1 DESC=
MAJOR=True</form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>OTHERFILENUMBER&l
t;/tagName><flags>0</flags><format>0</format><valu
e>692</value></form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>FNMA_FILENUMBER&l
t;/tagName><flags>0</flags><format>0</format><valu
e>693</value></form>
<form><sectionNumber>1</sectionNumber><primary>True</
primary><formName>1004</formName><tagName>SUBPROPADDRESS<
;/tagName><flags>0</flags><format>0</format><value
>3</value></form>
<attachment><key>db8d208f-b049-4caa-bac0-eeb4cf9007d6</key><
;type>photo</type><label>Comparable
Sale
#1</label><imageFormat>jpeg</imageFormat><imageText>/9j/
4AAQSkZJRgA</imageText><thumbnailFormat>jpeg</thumbnailFormat>
<thumbnailImage>/9j/4AAQSkZ</thumbnailImage><sourceFormat><
/sourceFormat><sourceKey></sourceKey><sourceText></sourc
eText></attachment>
<attachment><key>560ff252-882d-4d3e-9e0c-aa1cb7c38952</key><
;type>photo</type><label>Comparable
Sale
#2</label><imageFormat>jpeg</imageFormat><imageText>/9j/
4AAQSkZJR</imageText><thumbnailFormat>jpeg</thumbnailFormat>&l
t;thumbnailImage>/9j/4AAQSkZJR</thumbnailImage><sourceFormat><
/sourceFormat><sourceKey></sourceKey><sourceText></sourc
eText></attachment>
</REPORT>
******************************************************************
So close...
Thanks,
Tom
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
|
| Post Reply
|
| Re: Last position |
 |
Mon, 31 Mar 2008 11:21:48 -070 |
I almost have it (but not sure why the indents work here and not before)
"tshad" <tshad@dslextreme.com> wrote in message
news:%23FVN4o1kIHA.4120@TK2MSFTNGP06.phx.gbl...
> This is the 2nd question using the same answer you gave here.
>
<snip>
I added another apply-template and after a few tries got it close:
*****************************************************
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="REPORT">
<xsl:copy>
<xsl:apply-templates select="FORMS/FORM/FIELDS/*"/>
<xsl:apply-templates
select="FORMS/FORM/attachments/attachment/*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="FIELDS/*">
<form>
<sectionNumber>
<xsl:value-of select="../../@SECCODE"/>
</sectionNumber>
<primary>True</primary>
<formName>
<xsl:value-of select="../../@FORMCODE"/>
</formName>
<tagName>
<xsl:value-of select="name()"/>
</tagName>
<flags>0</flags>
<format>0</format>
<value>
<xsl:value-of select="."/>
</value>
</form>
<xsl:if test="position()=last()">
<form>
<sectionNumber>
<xsl:value-of select="../../@SECCODE"/>
</sectionNumber>
<primary>True</primary>
<formName>
<xsl:value-of select="../../@FORMCODE"/>
</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>
<xsl:apply-templates select="../../@*"/>
</form>
</xsl:if>
</xsl:template>
<xsl:template match="attachments/attachment/*">
<attachment>
<key>
<xsl:value-of select="@key"/>
</key>
<type>
<xsl:value-of select="@type"/>
</type>
<label>
<xsl:value-of select="@label"/>
</label>
<imageFormat>
<xsl:value-of select="image/binary/@format"/>
</imageFormat>
<imageText>
<xsl:value-of select="image/binary/text()"/>
</imageText>
<thumbnailFormat>
<xsl:value-of select="thumbnail/binary/@format"/>
</thumbnailFormat>
<thumbnailImage>
<xsl:value-of select="thumbnail/binary/text()"/>
</thumbnailImage>
<sourceFormat>
<xsl:value-of select="source/@format"/>
</sourceFormat>
<sourceKey>
<xsl:value-of select="source/@key"/>
</sourceKey>
<sourceText>
<xsl:value-of select="source/binary/text()"/>
</sourceText>
</attachment>
</xsl:template>
<xsl:template match="FORM/@*">
<xsl:value-of select="concat(name(), '=', .)"/>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
*********************************************
The only real change was adding the following line (after realizing it was
case sensitive):
<xsl:apply-templates
select="FORMS/FORM/attachments/attachment/*"/>
and the result is fine - except it now seems to have lost the
<form></form>
around the extra form element you created and it lost the indentation for
that line.
**********************************************************
<?xml version="1.0" encoding="utf-8"?>
<REPORT>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>OTHERFILENUMBER</tagName>
<flags>0</flags>
<format>0</format>
<value>692</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FNMA_FILENUMBER</tagName>
<flags>0</flags>
<format>0</format>
<value>693</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>SUBPROPADDRESS</tagName>
<flags>0</flags>
<format>0</format>
<value>3</value>
</form>
<form>
<sectionNumber>1</sectionNumber>
<primary>True</primary>
<formName>1004</formName>
<tagName>FormFormats</tagName>
<flags>0</flags>
<format>0</format>NUM=1 FORMCODE=1004 SECCODE=1 DESC=
MAJOR=True</form>
<attachment>
<key></key>
<type></type>
<label></label>
<imageFormat></imageFormat>
<imageText></imageText>
<thumbnailFormat></thumbnailFormat>
<thumbnailImage></thumbnailImage>
<sourceFormat></sourceFormat>
<sourceKey></sourceKey>
<sourceText></sourceText>
</attachment>
<attachment>
<key></key>
<type></type>
<label></label>
<imageFormat></imageFormat>
<imageText></imageText>
<thumbnailFormat></thumbnailFormat>
<thumbnailImage></thumbnailImage>
<sourceFormat></sourceFormat>
<sourceKey></sourceKey>
<sourceText></sourceText>
</attachment>
<attachment>
<key></key>
<type></type>
<label></label>
<imageFormat></imageFormat>
<imageText></imageText>
<thumbnailFormat></thumbnailFormat>
<thumbnailImage></thumbnailImage>
<sourceFormat></sourceFormat>
<sourceKey></sourceKey>
<sourceText></sourceText>
</attachment>
<attachment>
<key></key>
<type></type>
<label></label>
<imageFormat></imageFormat>
<imageText></imageText>
<thumbnailFormat></thumbnailFormat>
<thumbnailImage></thumbnailImage>
<sourceFormat></sourceFormat>
<sourceKey></sourceKey>
<sourceText></sourceText>
</attachment>
</REPORT>
***********************************************************
I separated the problem line by a couple of lines so it would stand out. As
you can see it is missing the <form> tags - which is why I assume it also
didn't indent correctly.
I'll try a couple of other things and maybe stumble on it.
Thanks,
Tom
>
> Thanks,
>
> Tom
>> --
>>
>> Martin Honnen --- MVP XML
>> http://JavaScript.FAQTs.com/
>
>
|
| Post Reply
|
|
|
|
|
|
|
|
|
|