I have a csv file that has two main cases
Case #1:
"surname, givenName, id#"
Case #2
"organizationName,, id#"
I'm doing a tokenize function to break up the file into document nodes on every carriage return.
<xsl:template match="/">
<!-- tokenize on line endings -->
<xsl:for-each select="str:tokenize(.,' ')">
<document>
<xsl:apply-templates select="." mode="new-document" />
</document>
</xsl:for-each>
</xsl:template>
so I have this:
<document>"Don Jackson,,19001"</document>
<document>"Frederick Guitars,,ed55555,,,O"</document>
<document>"Frederick Guitars,,ed11111,,,O"</document>
<document>"A WILLIAMS,JONES THOMPSON,141212"</document>
<document>"A RANJI,ALENA,741152"</document>
Now, I need to create content nodes within the document nodes, but the name of the content nodes will depend on the structure of the document node. Basically if the text after the first comma is null (meaning you get ',,'), then the name of the first content node will be "Organization". Otherwise, the first content node will be called "surname" and the name of the second content node will be "givenName". Third node will be ID_num, regardless.
It seems an xsl:choose should work here but I'm not sure how to implement it. Can someone provide some advice?
Thanks